View previous topic :: View next topic |
Author |
Message |
pic_micro
Joined: 07 Feb 2011 Posts: 26
|
MAX7456 GRAPHIC |
Posted: Mon Apr 18, 2011 9:13 am |
|
|
I found the code below from someone in the forum, I modify the pin out to my SIN/CS/CLK and MCU to match my custom hardware.
I want to display a text message on the screen "test1",
I couldn't get it to work. I see nothing on the screen.
Can any body help!
Code: | #include <16f877a.h>
#fuses XT, NOWDT, NOPROTECT, NOBROWNOUT, NOPUT, NOLVP
#use delay(clock=4000000)
#define MAX7456_CS PIN_A1
#define SCKL PIN_A3
#define SIN PIN_A2
int i;
void spi_write(int8 data) //software spi
{
for(i=0; i<=7; ++i)
{
output_low(SCKL);
if(bit_test(data, 7-i)) output_high(SIN);
if(!bit_test(data, 7-i)) output_low(SIN);
output_high(SCKL);
}
output_low(SCKL);
output_low(SIN);
}
//-----------------------------------------------
void max7456_write(int8 addr, int8 data)
{
output_low(MAX7456_CS);
spi_write(addr);
spi_write(data);
output_high(MAX7456_CS);
}
//-----------------------------------------------
void main()
{
output_high(MAX7456_CS);
output_low(PIN_b5); //indicate light power led
delay_ms(100); // Minimum power-up delay is 100 ms
max7456_write(0x00, 0b01001000); //enable osd
max7456_write(0x04, 0b01000000); //8-bit operation mode
while(1)
{
max7456_write(0x06, 0b00000000); //horizontal position
max7456_write(0x07, 'T');
max7456_write(0x06, 0b00000001);
max7456_write(0x07, 'E');
max7456_write(0x06, 0b00000010);
max7456_write(0x07, 'S');
max7456_write(0x06, 0b00000011);
max7456_write(0x07, 'T');
max7456_write(0x06, 0b00000100);
max7456_write(0x07, '1');
delay_ms(1000);
max7456_write(0x00, 0b01000000); //disable osd
delay_ms(1000);
}
}
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 18, 2011 11:22 am |
|
|
Did you build your own board, or did you buy one ? If you bought it,
post the manufacturer and part number of the board. Also post a link
to the website for it. If you built your own board, post a link to a
schematic of it.
Also post a list of all connections between the 16F877A and the MAX7456
board. |
|
|
pic_micro
Joined: 07 Feb 2011 Posts: 26
|
MAX7456 GRAPHIC |
Posted: Mon Apr 18, 2011 12:11 pm |
|
|
I build my own MAX7456 proto-breadboard (test board - jumper) according to SparkFun breakout board schematic, it connect to CCS PIC16F877A demo board
as follow:
CCS board ------------------- MAX7456 breadboard
A1----------------------------- \CS
A2----------------------------- SIN
A3------------------------------SCK
POWER-------------------------POWER
GND----------------------------GND
see schematic here (This is just for CCS firmware education/learning curve, not for commercial use)
http://www.lcmagicmoments.com/nou1/video.pdf
my test circuit on a
http://www.ezprototypes.com/BreadboardsMain.php
Please help me. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
pic_micro
Joined: 07 Feb 2011 Posts: 26
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 18, 2011 1:46 pm |
|
|
What about other tests. Have you looked at the CLKOUT pin with your
oscilloscope to see if has a 27 MHz signal on it ? This will tell you if
the oscillator in in the MAX7456 is running or not. |
|
|
pic_micro
Joined: 07 Feb 2011 Posts: 26
|
|
Posted: Mon Apr 18, 2011 2:17 pm |
|
|
Does my firmware looks ok?
Yes, my clock is running |
|
|
pic_micro
Joined: 07 Feb 2011 Posts: 26
|
|
Posted: Wed Apr 20, 2011 11:52 am |
|
|
I still try to figure it out but no luck.
My clock is running on CLKIN and CLKOUT. I also have a video signal (Scope probe) at the video out connector. But there is no text shown on the screen. The video kind of out synch (fussy screen)
http://lcmagicmoments.com/nou1/scope.jpg
I though the problem was the background brightness adjustment, but it is not.
Please help. I will appreciate it. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Apr 20, 2011 1:57 pm |
|
|
1. Do you have a video input signal to your board ? From a camera or
some other video source ?
2. You have programmed the MAX7456 for PAL mode. Is your input
signal in PAL format, and also your video monitor ? |
|
|
pic_micro
Joined: 07 Feb 2011 Posts: 26
|
|
Posted: Wed Apr 20, 2011 2:03 pm |
|
|
Yes I have video input. The video kind of out synch (fussy screen)
It is an NTSC for both the camera and the TV monitor.
I also try for PAL mode, but my camera and TV is NTSC, I still not see any text either.
Does it require the SOUT (data out) from the MAX7456 to the PIC inorder to display the text? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Apr 20, 2011 2:29 pm |
|
|
If I was doing this project, I would:
1. Use hardware SPI. The 16F877A has a hardware SPI module.
In my opinion, hardware SPI is easier to use, and easier to accurately
configure.
2. I would connect the full SPI port between the PIC and the MAX7456.
Yes, I would use the SDO pin on the MAX7456 (connect to SDI on the PIC).
3. The first thing I would do, is verify that I can write a value to the
MAX6456 Video Mode Register (address 0x00), and read it back correctly.
This would prove that my SPI interface is working.
I suggest that you do all this. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Wed Apr 20, 2011 8:49 pm |
|
|
If I may recommend, your subject would possibly gain more interest if you renamed it:
"MAX7456 On-Screen Display Char Generator" or some such.
"MAX7456 GRAPHIC" may not attract as many viewers as it's not very descriptive and could lead people to think "just another LCD Display post" where On-Screen displays are usually an interest of many.
Just a thought,
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
pic_micro
Joined: 07 Feb 2011 Posts: 26
|
MAX7456 OSD problem |
Posted: Wed Apr 20, 2011 9:01 pm |
|
|
I will try. |
|
|
lazuribicci
Joined: 06 Feb 2010 Posts: 10
|
Re: MAX7456 GRAPHIC |
Posted: Mon May 02, 2011 2:33 pm |
|
|
pic_micro wrote: | I found the code below from someone in the forum, I modify the pin out to my SIN/CS/CLK and MCU to match my custom hardware.
I want to display a text message on the screen "test1",
I couldn't get it to work. I see nothing on the screen.
Can any body help!
Code: | #include <16f877a.h>
#fuses XT, NOWDT, NOPROTECT, NOBROWNOUT, NOPUT, NOLVP
#use delay(clock=4000000)
#define MAX7456_CS PIN_A1
#define SCKL PIN_A3
#define SIN PIN_A2
int i;
void spi_write(int8 data) //software spi
{
for(i=0; i<=7; ++i)
{
output_low(SCKL);
if(bit_test(data, 7-i)) output_high(SIN);
if(!bit_test(data, 7-i)) output_low(SIN);
output_high(SCKL);
}
output_low(SCKL);
output_low(SIN);
}
//-----------------------------------------------
void max7456_write(int8 addr, int8 data)
{
output_low(MAX7456_CS);
spi_write(addr);
spi_write(data);
output_high(MAX7456_CS);
}
//-----------------------------------------------
void main()
{
output_high(MAX7456_CS);
output_low(PIN_b5); //indicate light power led
delay_ms(100); // Minimum power-up delay is 100 ms
max7456_write(0x00, 0b01001000); //enable osd
max7456_write(0x04, 0b01000000); //8-bit operation mode
while(1)
{
max7456_write(0x06, 0b00000000); //horizontal position
max7456_write(0x07, 'T');
max7456_write(0x06, 0b00000001);
max7456_write(0x07, 'E');
max7456_write(0x06, 0b00000010);
max7456_write(0x07, 'S');
max7456_write(0x06, 0b00000011);
max7456_write(0x07, 'T');
max7456_write(0x06, 0b00000100);
max7456_write(0x07, '1');
delay_ms(1000);
max7456_write(0x00, 0b01000000); //disable osd
delay_ms(1000);
}
}
|
|
I wrote this algorithm for 16f628 and 18f1320 two years ago. it works very well. but you try to run it on 16f877. 16f877 has a spi module, so spi_write command doesn't go subroutine "spi_write(int8 data) //software spi" . the command tries to use hardware spi.
if you want to use sofware spi subroutine, you have to change the name of it. for example software_spi instead of spi_write.
best regards,
Fatih |
|
|
|