CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

MAX7456 GRAPHIC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
pic_micro



Joined: 07 Feb 2011
Posts: 26

View user's profile Send private message

MAX7456 GRAPHIC
PostPosted: Mon Apr 18, 2011 9:13 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 18, 2011 11:22 am     Reply with quote

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

View user's profile Send private message

MAX7456 GRAPHIC
PostPosted: Mon Apr 18, 2011 12:11 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 18, 2011 12:57 pm     Reply with quote

What other MAX7456 input signals, such as \RESET ?

On page 10 of the Max7456 data sheet, it shows \RESET connected to +5v.
http://datasheets.maxim-ic.com/en/ds/MAX7456.pdf

The Sparkfun breakout board doesn't connect \RESET to any other circuit
on the board. It just goes from the Max7456 to the connector.
http://www.sparkfun.com/datasheets/BreakoutBoards/MAX7456_Breakout_v12.pdf

Do you have \RESET connected to +5v on your board ?
pic_micro



Joined: 07 Feb 2011
Posts: 26

View user's profile Send private message

PostPosted: Mon Apr 18, 2011 1:06 pm     Reply with quote

Yes, I connected it to 5V

See this

http://www.lcmagicmoments.com/nou1/video.pdf

Any others?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 18, 2011 1:46 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 18, 2011 2:17 pm     Reply with quote

Does my firmware looks ok?
Yes, my clock is running
pic_micro



Joined: 07 Feb 2011
Posts: 26

View user's profile Send private message

PostPosted: Wed Apr 20, 2011 11:52 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 20, 2011 1:57 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 20, 2011 2:03 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 20, 2011 2:29 pm     Reply with quote

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: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Wed Apr 20, 2011 8:49 pm     Reply with quote

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

View user's profile Send private message

MAX7456 OSD problem
PostPosted: Wed Apr 20, 2011 9:01 pm     Reply with quote

I will try.
lazuribicci



Joined: 06 Feb 2010
Posts: 10

View user's profile Send private message

Re: MAX7456 GRAPHIC
PostPosted: Mon May 02, 2011 2:33 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group