Go Down

Topic: MAX7456 library update (Read 16604 times) previous topic - next topic


Feb 17, 2012, 12:13 am Last Edit: Feb 17, 2012, 01:15 am by btmcmahan Reason: 1
Okay, I added PALmode( )....someone please let me know if it works, I have no way of testing it!

Plasmawall : PAL mode should allow you to write 15 rows (instead of 13 for NTSC)  But did you have any luck with the
set_screen ( ) feature?

I'm re-posting a link to the Max font editing program.

Also, I found this terminal program very helpful for transmitting my new font files to the arduino. I had to use the XonXoff setting.

And here is a good starting ASCII font file, I think dfraser made it, it was on the old forum.  There's plenty of open characters so you can start building your own.

My setup never worked correctly until I uploaded the ASCII font.


i'm gonna try pal mode right now! i will let you know in few hours if everything is ok.

anyway my ccd cam ouputs only pal but without input, ntsc works really fine so i think my screen is in bad mood with pal ( religion related i think^^).

i've managed to get a sketch to burn a new font file and then i use teraterm for sending mcm files( very easy, open teraterm and file-> send file-> pick your mcm and here we go!) i can pm you the sketch if you want to.

on my side i'm using the software from remzibi( it was intented to program a osd for a drone) the f2 let you use a great font editor with nice features like miroring characters, and you can see 2 characters at the same time, side to side without gap it's very useful to draw some icons or large letters wich takes 2 normal characters.

okay, everything works fine! pal mode is working 100% and the set screen size solved my problem. anyway in pal the osd has a lower resolution( not big difference but the outline of letters are flicking a little, making text not so readable( interlacing problem i think)
thank you so much btmcmahan
a last question, how( if possible) do you write a sentence with 0x** form? the fact is my font table is pretty big and i have to use some unpritable characters, i can use them with" osd.write(0xf1a);" but do i have to set the cursor and osd.write for every character or you, master of the code , have a solution to lighten my burden?

again thanks


you can use this:
osd.put(0xF4,5,7);  will print the character to column 5 row 7
osd.write(0xF5);     will print the character to the next position

So you only have to set the position once with osd.put () and then osd.write () for the other characters.
I'm happy to hear everything else is working good for you.

hello  do you know how i could control two max7456? i know i should declare another slave select pin to send signal on the other max but how should i modify tour library? it's in order to drive a stereoscopic device so the most of characters are the same on both  ic could duplicate your library with another name and another pin for SS and copypaste my code linking to the new lib like:

#include "MAX7456_osd.h"
MAX7456 osdright;
MAX7456 osdleft;
void loop(){

but it's memory expensive and pretty slow to run. is there a better way?

thanks for any advice


Define "memory expensive" and "slow".

There are about 7 "byte" variables per instance, and it writes at an SPI rate of1/4 of the system clock.

At least that's how it is in my version of the code.  Not sure about btmcmahan's version.


my sketch is pretty large and on the way i'm seeing stereoscopy i've had to double it ( one part for the right and one part for the left camera) so basically it's going to take twice memory and twice time to execute( i'mworking with a mini arduino328) there is maybe a bit of superstition here but i think there is a better/smoother way ( and if i have to change something i don't want to do it twice on my sketch so i was looking to add a "side_byte" for "left" "right" and "both" to "void MAX7456::cursor(byte side,byte x, byte y, byte blink, byte invert, byte char_bg){" ( i've take cursor as an exemple but adding it to all functions and dependencies) right now it's not working.( i'm pretty new to c++ and arduino coding so i make a lot of mistakes and misunderstanding and it takes me times to really comprehend your work^^)


okay, I think this will do it.  There was something similar in the kg4wsv-zitron-dfraser version, but I didn't know what it did so I took it out!  Now I know what it did.  This should allow you to use as many OSD's as you want, but I only have one, so you'll have to let me know if it is working correctly.

In your H FILE, insert this:

Code: [Select]
class MAX7456 : public Print
  void begin();
  void begin(int ss_pin);          //************INSERT THIS LINE
  void slave_select(int ss_pin);   //************INSERT THIS LINE
// Setup Funtions
  void PALmode();

In your CPP FILE, insert this (near the beginning):

Code: [Select]
  _slave_select = MAX7456SELECT;
  _char_attributes = 0x01;
  _cursor_x = CURSOR_X_MIN;
  _cursor_y = CURSOR_Y_MIN;}

void MAX7456::slave_select(int ss_pin){  //************INSERT THIS LINE
  _slave_select = ss_pin;                //************INSERT THIS LINE
  pinMode(_slave_select,OUTPUT);}        //************INSERT THIS LINE

void MAX7456::begin(int ss_pin){         //************INSERT THIS LINE
  _slave_select = ss_pin;                //************INSERT THIS LINE
  begin();}                              //************INSERT THIS LINE

void MAX7456::begin(){
  byte spi_data;
// int x;

In your sketch, you will have to "begin" each osd device in the setup:
Code: [Select]
osd.begin (14);  // Where one osd has slave select on pin 14
osd.begin (18);  // Where another osd has slave select on pin 18

In your loop, you can switch between each osd like this:
Code: [Select]
osd.println("Stuff for the left screen");

osd.println("Stuff for the right screen");

yeah it works! i still haven't received my second max7456 but with one , switching between slave select pins and reseting the whole build i have 2 different displays.there is a slight problem,the PALmode() code isn't working on the second osd
the first one i'm using in my sketch is in pal but the second is set in ntsc.


ya, that makes sense.  You need to upload your settings into each osd board.
You're gonna have to send the osd.PALmode( ) and osd.set_vm1( ) after each osd.begin().
Otherwise each board will begin with the default settings.

okay i get it .thanks i understand how it works now. well the most of it...^^


Interesting reading...
I have used kg4wsv code with Both formats and they both work.
Many thanks for all the work you people have put in to developing the MAX7456 interface.
I am putting together the control system for my hobby RoV. ( Remotley operated Vechicle)

It's also would be nice to provide people with an example/keyword usage so people like myself can learn how it's done.  BTW this is not critisum of what you do.

Thanks again Antony


Huh, I thought I included an example that last time, but obviously I didn't.  Here's one:


This is a basic sketch that is meant for amateur radio callsign overlay (the call is NOCALL in the sketch).  It also displays battery voltage.  Here is the schematic for the hardware it runs on.


Btmcmahan, I tried your most recent library posted here with the demo example, and I can't compile it. I get the following compile errors (and more like these):

/Users/macbookpro/Documents/Arduino/libraries/Max7456_osd/MAX7456_osd.h:123: error: 'byte' has not been declared
/Users/macbookpro/Documents/Arduino/libraries/Max7456_osd/MAX7456_osd.h:124: error: 'uint8_t' has not been declared
/Users/macbookpro/Documents/Arduino/libraries/Max7456_osd/MAX7456_osd.h:127: error: 'byte' has not been declared
/Users/macbookpro/Documents/Arduino/libraries/Max7456_osd/MAX7456_osd.h:130: error: 'byte' has not been declared
/Users/macbookpro/Documents/Arduino/libraries/Max7456_osd/MAX7456_osd.h:133: error: 'byte' has not been declared
/Users/macbookpro/Documents/Arduino/libraries/Max7456_osd/MAX7456_osd.h:139: error: 'byte' does not name a type
/Users/macbookpro/Documents/Arduino/libraries/Max7456_osd/MAX7456_osd.h:140: error: 'byte' does not name a type
/Users/macbookpro/Documents/Arduino/libraries/Max7456_osd/MAX7456_osd.h:141: error: 'byte' does not name a type
/Users/macbookpro/Documents/Arduino/libraries/Max7456_osd/MAX7456_osd.h:142: error: 'byte' does not name a type
max7456_demo.pde: In function 'void loop()':
max7456_demo:17: error: 'class MAX7456' has no member named 'println'
max7456_demo:19: error: 'class MAX7456' has no member named 'print'
max7456_demo:21: error: 'class MAX7456' has no member named 'println'
max7456_demo:23: error: 'class MAX7456' has no member named 'println'
max7456_demo:25: error: 'class MAX7456' has no member named 'println'

I have your library loaded in the correct folder and am using Arduino 1.0.2.

Do you have any thoughts? I can usually follow code, but when it comes to libraries and the mapping of characters on screen, I am in the dark for the most part (but am trying to figure it out....).

I also tried the most recent library in this thread by Kg4wsv and the simple code he provided, (without loading the new ascii characters) and it works for the most part. I have noticed if I try to use a capital "C" it does not show, and may make some of the surrounding text disappear.

I would like to use Btmcmahan's library, as I want to put this on a mega (using an uno currently). Otherwise, I could use Kg4wsv's library and I imagine I would have to figure out how to update the pins in the library. I'd also like to figure out how to show the symbols in the Max745, but can't seem to figure that out from Kg4wsv's example.

If anyone has time to help me with any of these questions, I'd appreciate it.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131