Go Down

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


Feb 09, 2012, 04:52 am Last Edit: Feb 17, 2012, 12:22 am by btmcmahan Reason: 1
Okay, I have some updates to the library if anyone wants to check it out.  First, it now works with both Mega and Uno! Just select the correct board in Arduino IDE, and it's gonna work!

The font upload program works with Mega & Uno (or deci)

Next, I changed some stuff:

blink() & no_blink(), invert() & no_invert()  to
osd.blink_on & osd.blink_off
osd.invert_on() & osd.invert_off()
osd.write_to_screen() is now osd.print_full_screen("characters",x,y,blink,invert,char_bg)

Also, I added:
char_bg_on() and char_bg_off()for individual character backgrounds.
osd.cursor(x,y)   and
this will look like:osd.cursor(5,2,1,0,1) and gives you column 5, row 2, blink on, invert off, and character background on.

Here's the big additions:

osd.set_vm1(blink_duty, blink_time, gray_lvl, bg_mode
this function sets your video mode 1 options (see max7456 datasheet)
you can use this function anytime, in the setup or during the loop.  
It looks like this: osd.vm1_set(75,3,7,0)
the blink_duty can be set to 25, 33, 50, or 75.  This would be for the blink "on time"... like (33% on & 66% off).
the blink_time can be set from 0 to 3, where 0 blinks the fastest, and 3 blinks the slowest.
the gray_lvl can be set from 0 to 7, where 0 is the darkest (black) and 7 is the lightest (very light gray).
the bg_mode can be set at 0 or 1, where 0 gives you the video_in background, and 1 gives you gray background.

osd.set_screen(x_min, x_max, y_min, y_max, x_offset, y_offset)
this function lets you adjust the area to accommodate your screen.
it looks like this: osd.set_screen(1,28,2,11,-5,-8)
x_min & x_max let you set your first & last viewable column, y_min & y_max set your first & last viewable rows.
x can be 0 to 29, and y can be 0 to 12.  I don't have a PAL tv, but I assume y could be 0 to 15 if needed.
**in my example, column 1 becomes column 0, and row 2 becomes row 0...
**so if you use cursor(0,0) you will actually write to column 1 and row 2.
**this way you don't have to over-think the locations, just set your screen and everything else works okay with it
x_offset lets you shift your screen left & right, -32 for 32 pixels left, 0 for no shift, and 31 for 31 pixels right.
y_offset lets you shift your screen up & down. -16 for 16 pixels up, 0 for no shift, and 15 for 15 pixels down.
like my other functions, this can be used anywhere in your sketch.
the osd.print_full_screen () function is the only function this is not limited to your defined screen area.

this function lets you change the white level brightness on any row.
you can set any row, and the white_level can be 0 to 3, with 0 being brightest white, and 3 being dullest white.
it looks like this: osd.set_white_level (2,3) to set row 2 to the dullest white,
OR osd.set_white_level(all_rows,0) to set all rows to the brightest white.

last, osd.put(hex, x,y,blink,invert, char_bg)
OR osd.put(hex,x,y)
these functions let you print a hex character with the normal options
it looks like osd.put(0x8F,3,6,0,1,0)

osd.PALmode ( ) can be used if you have a PAL display.  You may have to use osd.set_screen ( ) to change the number of rows from (13 on NTSC) to (15 on PAL).  The code will default to a NTSC setup.

I think that's everything that needs explaining.  I just expanded on work done by Please let me know what you think, but be gently, this is my first library upload!


Thanks to dfraser, zitron, and kg4wsv.  I'm really just expanding on work they did first.

P.S.  If your video goes in and out, try uploading a new font.  That magically solved my problem.  Don't know why, don't care.


I'am a new one and my first post is for you : What a great job !!!!!
Just a question in your last release the PAL mode is missing. Can you indicate what I need to modfied ?

Thanks a lot


actually i have the same problem, great job btmcmahan but adding the palmode( i've tried copy/paste in the cpp file, i guess this was a stupid idea^^) isee how you print a character with its hex adress " 0x**" thanks to your demo sketch, but how to do the same with the lib of kg4wsv?
i have a small issue with my screen, i have some empty space on the bottom, the video is really full screen but it's seems that it's missing two lines, they are wrapping on top of the screen, over the first lines. any idea? is there a way to " offset" the display?
i'm trying to make a HUD, with a reticle in the center, and some displays on the sides, i've done a new char set,and  put it successfully on the chip. any hint on how to display these? some sort of general idea to put everything together( i' was thinking to put some variables on strings to display different icons but thre is maybe a better way to go...)
anyway lot of thanks, iwould never been able to go so far without your work.


yes, you can set the amount of rows displayed with the osd.set_screen( ) function, and you can also do the offset with this function.  But if your rows are wrapping around to the top, I would suggest using set_screen to remove. 12th and 13th rows.  As for the PAL, if someone wants to post the old code I will integrate it into my cpp and h file.  I don't have any versions with PAL support to look at.


thanks i will try this today, i'm wondering if it's not the fault to my screen( a cheap 4" tft screen from hk) and i've read that pal has a row less than ntsc.
the lib with the pal code is on the reply #11 of kg4wsv on this thread. there is a few lines on the begining of the .cpp concerning the pal code but i've never done a lib so there may be something elsewere.
i haven't checked but have you left the boolean to use the original and modified ascii .mcm? this can be useful too.

Go Up