MAX7456 library update

I've made a few updates to the MAX7456 video overlay library. The begin() function now has a second optional boolean parameter that causes the library to translate from ASCII to the MAX7456 native character set. This allows you to use the MAX7456 straight out of the box - no character memory reloading required! Just use osd.begin(SLAVE_SELECT, true); to take advantage of the translation.

It has also been updated to work with the soon to be released Arduino 1.0.

This functionality has not been tested extensively; please PM me if you have problems.

The latest version can be downloaded at http://www.eng.uah.edu/~jdw/avr/MAX7456_lib_2011-10-31.tar.gz .

-j

Hello,
We have been trying for two days to get the sparkfun max7456 going on some of D Frasers code and have up loaded the new character set.
The funny characters in the picture were there from the start before the new character sets. we downloaded your library but winzip free trail version barffs on the file format. Any chance of pointing towards a windows zip file of your work or please if anyone has a clue as to why the characters please let us know. Skill levels fairly low on our side. Thank you for your time

kg4wsv, thank for posting the library.

I'll try the library out on my home made OSD shield, once the PCB's come back from the manufacturers.

we downloaded your library but winzip free trail version barffs on the file format.

It's a gzipped tarball; I thought winzip could handle those. I've extracted it on the web site; it's a directory and two files. You can grab them and recreate in your libraries folder.

http://www.eng.uah.edu/~jdw/avr/MAX7456/

if anyone has a clue as to why the characters

Looks like maybe you were not completely successful in converting the character set, or maybe the character memory didn't get cleared?

Try a sketch with the updated library; if you get the same (garbage) results, you may need to try doing the character set conversion again.

-j

Thanks for the quick response. The character set is stuck in the old one with the first space character corrupted so if you change the original d fraser code with the mapping in to char32 = any other character in the old table it will put in the correct character. Using teraterm to up load and it takes the three minutes as suggested.
Downloaded the two files thank you and created a directory in the libraries folder and ran one of your first sample sketches but get this
error as we said fairly low skilled in C. Any help appreciated

MAX7456_lib_test.cpp: In function 'void setup()':
MAX7456_lib_test:14: error: no matching function for call to 'MAX7456::begin()'
C:\Users......\Downloads\arduino-0022\arduino-0022\libraries\MAX7456/MAX7456.h:105: note: candidates are: void MAX7456::begin(byte, boolean)
MAX7456_lib_test.cpp: In function 'void loop()':
MAX7456_lib_test:60: error: 'class MAX7456' has no member named 'noblink'
MAX7456_lib_test:67: error: 'class MAX7456' has no member named 'noblink'
MAX7456_lib_test:68: error: 'class MAX7456' has no member named 'noinvert'

ran one of your first sample sketches

Wow, that MAX7456_lib_test is ancient. It isn't compatible with the library (except maybe an extremely early 0.0.0 alpha version). Thanks for pointing this out - I'll get rid of it.

Try this code.

-j

// video overlay for ATV
// code for the kg4wsv video overlay board
// 8MHz board, internal 8MHz oscillator, MAX7456, 3:1 voltage divider on analog input 3
// kg4wsv at or near gmail

#include "MAX7456.h"
MAX7456 osd;

#define MAX7456_SELECT 10


void setup()
{
  Serial.begin(9600);

  osd.begin(MAX7456_SELECT, true); // true means we're using the MAX7456 native character set
                                   // remove if you've done the ASCII character set load on your 7456
}


void loop()
{
  float voltage;
  
  // 3:1 voltage divider, 5V reference, 10 bit ADC
  voltage = 4.0 * 5.0 * ((float) analogRead(3)) / 1024.0;

  osd.home();
  osd.println("");
  osd.print("KG4WSV              ");
  osd.print(voltage);
  osd.println("V    ");

  Serial.print("KG4WSV ");
  Serial.print(voltage);
  Serial.println("V");

  delay(250);
}

thanks, compiled and uploaded, have fixed the dud character in the max unit. Still have a little maybe hardware issue where the characters only turn up after the video source is turned off, but the serial output shows that the voltage keeps on being read. Thanks again will keep on playing

Hello, I have a problem :blush:, the characters only turn up after the video source is turned off can you help me to solve it please?

Thanks.

This the point where we usually ask for a schematic and your code...

Sounds like a bad video signal, or a hardware problem. Does the MAX7456 pass the video through while connected?

Is this PAL or NTSC? THe library is written for NTSC; you'll have to change code in the library to support PAL.

The MAX7456 has 4 "modes" for the output sync signal. They are:

  • use the eternal source
  • use an internally generated sync
  • use external if it's there, otherwise use the internal
  • no sync; no display

The library uses the third mode (use external if available, internal otherwise) because it allows the most flexibility and it's always worked for me. Your problem sounds as if there may be a bad signal on the input.

-j

OK PAL or NTSC is the problem. I work with PAL signal and when I imput a NTSC signal the MAX7456 work perfectly and now... What library I have to change and what lines must I change for work perfecly in PAL mode?

sorry for my bad english. Thanks

In the file MAX7456.cpp, look for this code starting at line 152:

// make sure the MAX7456 is enabled
  digitalWrite(_slave_select,LOW);
  MAX7456_spi_transfer(VM0_WRITE_ADDR);
  MAX7456_spi_transfer(VERTICAL_SYNC_NEXT_VSYNC|OSD_ENABLE);
  digitalWrite(_slave_select,HIGH);
  delay(100);

Change the line

  MAX7456_spi_transfer(VERTICAL_SYNC_NEXT_VSYNC|OSD_ENABLE);

to this

  MAX7456_spi_transfer(VERTICAL_SYNC_NEXT_VSYNC|OSD_ENABLE|VIDEO_MODE_PAL);

Please report back if that solves the problem. I'm aware that lots of the world uses PAL, but I don't have any hardware to test with, so I haven't added code to switch to PAL mode. If this works for you, I'll try to add a PALL switch to the library.

-j

I've added a new function to the library: PALmode(). Call it after begin(), e.g.

  osd.begin(MAX7456_SELECT, true);
  osd.PALmode();

you can download it at http://www.eng.uah.edu/~jdw/avr/MAX7456_lib_2011-12-18.tar.gz

If you try it, please let me know the results.

-j

KG4WSV, first I want to thank you for all your hard work on the Max7456. Maybe you are the one who can help me. I've tried almost every lib I can find online, and I just can't get mine to work. I'm using an Arduino Mega 1280 with the Sparkfun max7456 Breakout Board.

In max7456.H, I changed your code:

#define MAX7456_DATAOUT 11//MOSI
#define MAX7456_DATAIN  12//MISO
#define MAX7456_SCK  13//sck
#define MAX7456SELECT 10//ss
#define MAX7456_VSYNC 2// INT0

to this, for the Mega:

#define MAX7456_DATAOUT 51//MOSI
#define MAX7456_DATAIN  50//MISO
#define MAX7456_SCK  52/sck
#define MAX7456SELECT 53//ss
#define MAX7456_VSYNC 2// INT0

Next, I changed your sketch code from:

#define MAX7456_SELECT 10

to:

#define MAX7456_SELECT 53

I have the Max Breakout Board DIN to 50, DOUT to 51, SCK to 52, CS to 53, and VSYNC to 2. I feel like I'm making some stupid mistake, because it all seems SO simple.

I'm not getting any kind of text on my screen. Also, I'm having the same problem as everyone else, my screen only displays for 5 or 10 seconds...and yes, I have Max RST on a 10k resistor to +5V.
I feel like I'm taking crazy pills! If anyone can help me I will forever be in your debt!

Thanks, but really dfraser and zitron did the hard work - I just packaged their work and changed a bit to suit myself. :slight_smile:

I don't know of anyone who has used the library to interface with the MEGA - I know I haven't.

Your pins look right, but I wonder if the SPI registers are configured the same on the ATmega1280 as on the ATmega8 family?

FYI, the VSYNC/INT connection isn't used.

-j

Well, that gives me something to look into. Any ideas about the video going in and out every few seconds?

NTSC or PAL?

Could 10k be a bit weak? I tie reset directly to 5V.

-j

I have a NTSC setup. I tried tying reset directly to +5v when I first wired it up, with the same result. I am going to look into the SPI registers, as you recommend, but that is going to slow learning experience. The Sparkfun Tech Support emailed me back today, they suggested using an Arduino UNO. I really hate to admit defeat, but I'm at the point where I'll probably just buy an UNO and try that.

not sure what your setup is like on the video side, but if you have an input signal (camera, receiver, etc), disconnect it and drive just the output.

The way the library is configured, the MAX7456 will use the video sync from the input if one is present, but generate its own if there is no input.

If something is hinky with the input, it could be messing up the sync circuit in the 7456, resulting in the output dropping out.

-j

Okay, the good news is I got the on screen display working, but it is still drops the video after a few seconds. I've tried connecting the RST directly to +5v, and also with 1k and 10k resistors. I've tried several different video sources, as using no video, but it always drops the video after a few seconds. Any ideas?

Have you tried driving a different display?

Sorry, I'm just guessing at this point. I've never had much trouble out of the device, and the troubles I had were all software related.

Why don't you post your schematic and code? Maybe someone is lurking who's used the MEGA with the MAX7456.

-j