Arduino Forum

Development => Other Software Development => Topic started by: kg4wsv on Oct 31, 2011, 11:04 pm

Title: MAX7456 library update
Post by: kg4wsv on Oct 31, 2011, 11:04 pm
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 (http://www.eng.uah.edu/~jdw/avr/MAX7456_lib_2011-10-31.tar.gz) .

-j
Title: Re: MAX7456 library update
Post by: cncbits on Dec 13, 2011, 05:41 am
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
Title: Re: MAX7456 library update
Post by: TonyD on Dec 13, 2011, 10:03 am
kg4wsv, thank for posting the library.

I'll try the library out on my home made OSD shield (http://zuzebox.wordpress.com/2011/11/22/max7456-osd-shield-v0-1/), once the PCB's come back from the manufacturers.
Title: Re: MAX7456 library update
Post by: kg4wsv on Dec 13, 2011, 04:53 pm
Quote
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/ (http://www.eng.uah.edu/~jdw/avr/MAX7456/)

Quote
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
Title: Re: MAX7456 library update
Post by: cncbits on Dec 14, 2011, 06:57 am
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'
Title: Re: MAX7456 library update
Post by: kg4wsv on Dec 14, 2011, 04:22 pm
Quote
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


Code: [Select]
// 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);
}
Title: Re: MAX7456 library update
Post by: cncbits on Dec 15, 2011, 06:49 am
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
Title: Re: MAX7456 library update
Post by: fernank2 on Dec 18, 2011, 01:38 am
Hello, I have a problem  :smiley-red:, the characters only turn up after the video source is turned off can you help me to solve it please?

Thanks.
Title: Re: MAX7456 library update
Post by: kg4wsv on Dec 18, 2011, 02:15 pm
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:


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
Title: Re: MAX7456 library update
Post by: fernank2 on Dec 18, 2011, 05:53 pm
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
Title: Re: MAX7456 library update
Post by: kg4wsv on Dec 18, 2011, 06:10 pm
In the file MAX7456.cpp, look for this code starting at line 152:
Code: [Select]
// 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
Code: [Select]
  MAX7456_spi_transfer(VERTICAL_SYNC_NEXT_VSYNC|OSD_ENABLE);

to this
Code: [Select]
  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
Title: Re: MAX7456 library update
Post by: kg4wsv on Dec 18, 2011, 06:35 pm
I've added a new function to the library:  PALmode().  Call it after begin(), e.g.
Code: [Select]
  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 (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
Title: Re: MAX7456 library update
Post by: btmcmahan on Jan 12, 2012, 03:08 am
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:
Code: [Select]

#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:
Code: [Select]
#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:
Code: [Select]
#define MAX7456_SELECT 10
to:
Code: [Select]
#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!
Title: Re: MAX7456 library update
Post by: kg4wsv on Jan 12, 2012, 03:22 am
Thanks, but really dfraser and zitron did the hard work - I just packaged their work and changed a bit to suit myself. :)

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
Title: Re: MAX7456 library update
Post by: btmcmahan on Jan 12, 2012, 04:38 am
Well, that gives me something to look into.  Any ideas about the video going in and out every few seconds?
Title: Re: MAX7456 library update
Post by: kg4wsv on Jan 13, 2012, 03:48 am
NTSC or PAL?

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

-j
Title: Re: MAX7456 library update
Post by: btmcmahan on Jan 13, 2012, 04:17 am
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. 
Title: Re: MAX7456 library update
Post by: kg4wsv on Jan 13, 2012, 01:49 pm
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
Title: Re: MAX7456 library update
Post by: btmcmahan on Jan 23, 2012, 12:18 am
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?
Title: Re: MAX7456 library update
Post by: kg4wsv on Jan 23, 2012, 03:58 pm
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
Title: Re: MAX7456 library update
Post by: plasmawall on Jan 24, 2012, 03:37 pm
hello

first thank you alot kg4wsv and dfraser and zitron for putting up this code and libraries, this saved me.

i'm having the same kind of problems than you btmcmahan, exept that i still don't have any characters displayed. i've managed to burn a new ascii table( i was thinking that would be the most difficult) i'm using an arduino mini with the atmel328, the max7456 board from sparkfun , already read every thread about it( arduino cc forum and sparkfun forums) my wirings are:
arduino==== max7456
   pin10 ====cs
   pin11====dout
   pin12====din
   pin13====sck
   pin2====vsync
+5v to +5v and gnd to gnd i've tried rst to +5v with a resistor and without
i'm using the last libraries that you kg4wsv have posted here, the sketch that you have posted here, i've included the line for the pal mode and corrected the first line as i've a new ascii table.
i have no input
and the problem is my display is still black, flashing white every second( almost) and flashing blue every 10secs or so cause my tv is a kind of hightech thing and tries to understand the signal( normally she can switch on the right entry and to the right signal type(ntsc /pal/secam)
so i've opened up the lib and as i'm pretty new to c++ i was wondering what was the " #if ARDUINO > 22" at the begining? where did you specify the pin n° for the arduino it seems that it's in an integrer but i can't found it...? and in the comments of the sketch you speak about the 8mhz of the arduino, mine is 16mhz do this can cause problems for communication with the max7456? and how can i write something in the middle of the screen? i think maybe the writings are some kind of "off the screen" cause it's doing the same when my computer tries to send a signal with a wrong frequency/resolution.

i know there is a lot of questions and please excuse my bad english.
i hope thoses questions can lead to the solution.
Title: Re: MAX7456 library update
Post by: kg4wsv on Jan 25, 2012, 04:02 pm
Here is a link to the code I posted previously (http://www.eng.uah.edu/~jdw/avr/ATV_OSD.ino).

Here is the schematic:
(http://www.eng.uah.edu/~jdw/avr/MAX7456_OSD.png)

This might be a bit confusing because it's not a true arduino; it's a complete arduino-compatible solution.  You can ignore the part about an 8MHz clock; that's just my notes on which hardware matches the sketch.  It does not matter at all from the MAX7456 standpoint.


This is a schematic for a shield I designed and built:

(http://www.eng.uah.edu/~jdw/avr/MAX7456_shield.png)

This one shows arduino pin numbers.  The jumpers on pins 4 - 10 allow me to select a different digital output as slave select, so that the shield is compatible with other SPI shields.


Quote
what was the " #if ARDUINO > 22" at the begining?


The structure of the arduino code internals changed at version 22; this preprocessor directive allows the library to be compatible with both old and new versions of the arduino system, without you even knowing that it happens. (I mention it because you ask, but you don't have to care about this if the code compiles.)


Quote
where did you specify the pin no for the arduino it seems that it's in an integrer but i can't found it...?


It's in the library near the top of MAX7456.h.  The arduino pin numbers for lines other than slave select are hard coded in the library to the ATmegaxx8 family SPI pins. Note that the slave select here is a default, and VSYNC is not used. Here is the pertinent code:

Code: [Select]
#define MAX7456_DATAOUT 11//MOSI
#define MAX7456_DATAIN  12//MISO
#define MAX7456_SCK  13//sck
#define MAX7456SELECT 10//ss
#define MAX7456_VSYNC 2// INT0




Let me emphasize that I have no idea if my PAL support code is correct - I haven't heard from anyone that has used it successfully, and I have no way to test it.

If your TV is super-smart about mode matching, try it with NTSC mode.  Even if you live in a PAL part of the world, many of the TV manufacturers find it easier to design a unit that supports both NTSC and PAL, rather than designing (and manufacturing and distributing and supporting...) two different TVs that are identical except for PAL vs. NTSC, so your TV may accept NTSC.

As for "off the screen", I'd print 15 or 20 lines (long lines, like 20 or 25 characters) to make sure the screen was full.

-j
Title: Re: MAX7456 library update
Post by: plasmawall on Jan 26, 2012, 11:15 am
thank you alot! its working now! i don't really know what was wrong, i've re-wired everything, re-uploaded the sketch , changed the video cable and changed the tv, and now everything is ok( exept that apparently the new character table was not burned on the max7456.... dunno, gonna try again....) so a really big thank you!
    it's alive! it's allliiiiiiiveeeeee!!!!!
Title: Re: MAX7456 library update
Post by: btmcmahan on Feb 03, 2012, 03:09 am
Hey guys, I got the osd working on my Mega.   But one thing I still don't get, why does print() and println() work when neither one is defined in the H file or cpp file?  How does that work?

Thanks for the help.
Title: Re: MAX7456 library update
Post by: kg4wsv on Feb 03, 2012, 03:54 pm
Quote
why does print() and println() work when neither one is defined in the H file or cpp file?


It's the magic of C++ inheritance.  I define a write() function that accepts a single byte to be displayed, then inherit all the nifty functions in the Print class with

Code: [Select]
class MAX7456 : public Print

All I have to do for the 7456 is keep up with where the cursor is, and displaying the bytes that get sent to write().  Converting ints and floats and strings to a sequence of printable ASCII characters is magically (from my point of view) done by Print.

-j
Title: Re: MAX7456 library update
Post by: btmcmahan on Feb 09, 2012, 04:52 am
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
osd.cursor(x,y,blink,invert,char_bg)
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.

osd.set_white_level(row,white_level)
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!

http://www.filefactory.com/file/c5da981/n/Max7456_osd.zip (http://www.filefactory.com/file/c5da981/n/Max7456_osd.zip)

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.
Title: Re: MAX7456 library update
Post by: Bledi on Feb 15, 2012, 03:29 pm
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
Title: Re: MAX7456 library update
Post by: plasmawall on Feb 15, 2012, 08:59 pm
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.
Title: Re: MAX7456 library update
Post by: btmcmahan on Feb 16, 2012, 06:04 am
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.
Title: Re: MAX7456 library update
Post by: plasmawall on Feb 16, 2012, 10:52 am
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.

Title: Re: MAX7456 library update
Post by: btmcmahan on Feb 17, 2012, 12:13 am
Okay, I added PALmode( )....someone please let me know if it works, I have no way of testing it!
http://www.filefactory.com/file/c5da981/n/Max7456_osd.zip (http://www.filefactory.com/file/c5da981/n/Max7456_osd.zip)

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.
http://www.maxim-ic.com/datasheet/index.mvp/id/5569 (http://www.maxim-ic.com/datasheet/index.mvp/id/5569)

Also, I found this terminal program very helpful for transmitting my new font files to the arduino. I had to use the XonXoff setting.
http://www.hyperserialport.com/ (http://www.hyperserialport.com/)

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.
http://www.filefactory.com/file/c3a0f25/n/ascii_font_set.mcm (http://www.filefactory.com/file/c3a0f25/n/ascii_font_set.mcm)

My setup never worked correctly until I uploaded the ASCII font.
Title: Re: MAX7456 library update
Post by: plasmawall on Feb 18, 2012, 06:43 pm
wondefull!

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.
Title: Re: MAX7456 library update
Post by: plasmawall on Feb 18, 2012, 07:17 pm
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
Title: Re: MAX7456 library update
Post by: btmcmahan on Feb 18, 2012, 07:31 pm
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.
Title: Re: MAX7456 library update
Post by: plasmawall on Feb 18, 2012, 11:09 pm
you made my day sir!
Title: Re: MAX7456 library update
Post by: plasmawall on Feb 25, 2012, 10:23 am
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(){
osdright.write(0x91);
osdleft.write(0x92);

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

thanks for any advice
Title: Re: MAX7456 library update
Post by: kg4wsv on Feb 25, 2012, 11:03 pm
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.

-j
Title: Re: MAX7456 library update
Post by: plasmawall on Feb 26, 2012, 11:59 am
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^^)


Title: Re: MAX7456 library update
Post by: btmcmahan on Feb 26, 2012, 02:18 pm
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
{
public:
  MAX7456();
  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]
MAX7456::MAX7456(){
  _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.slave_select(14);
osd.println("Stuff for the left screen");

osd.slave_select(18);
osd.println("Stuff for the right screen");
Title: Re: MAX7456 library update
Post by: plasmawall on Feb 26, 2012, 08:39 pm
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.
Title: Re: MAX7456 library update
Post by: btmcmahan on Feb 26, 2012, 09:06 pm
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.
Title: Re: MAX7456 library update
Post by: plasmawall on Feb 27, 2012, 10:38 pm
okay i get it .thanks i understand how it works now. well the most of it...^^
Title: Re: MAX7456 library update
Post by: antony1876 on Jun 02, 2012, 09:53 am
Hi.
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
Title: Re: MAX7456 library update
Post by: kg4wsv on Jun 06, 2012, 04:45 pm
Huh, I thought I included an example that last time, but obviously I didn't.  Here's one:

http://www.eng.uah.edu/~jdw/avr/MAX7456_example.pde (http://www.eng.uah.edu/~jdw/avr/MAX7456_example.pde)

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 (http://www.eng.uah.edu/~jdw/avr/MAX7456_OSD.png) for the hardware it runs on.

-j
Title: Re: MAX7456 library update
Post by: chiliman77 on Mar 12, 2013, 01:09 am
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.
Title: Re: MAX7456 library update
Post by: chiliman77 on Mar 30, 2013, 02:10 pm
So I updated the pins in Kg4wsv's example for my mega, and now I am running into the same problems originally encountered in this thread. How was the screen blinking and shutting off after around 10 seconds solved? I don't think you ever said.

Thanks.
Title: Re: MAX7456 library update
Post by: Supercln on Mar 04, 2014, 05:20 pm
Hi guys
I'm pulling my hair here.
Have tried all the libraries in this post and the one in dfraser's one, and i can't overlay anything while video is on. i'm using Pal, and tried  different libraries. When i turn the video source off i get the overlay(see attached pic) Ingenn's code
The code posted by kg4wsv in reply 5 is working, but i need to be able to send number/text from a terminal to be overlayed, through serial.
Any help would be greatly appreciated.
Thanks
Title: Re: MAX7456 library update
Post by: K_onghena on Apr 02, 2014, 06:51 am
Hi,

I am having the same problem, used an NTSC camera for testing everything but the camera used in the setup is apparently a PAL.
No video source connected or with the NTSC camera it works perfect, the other one only shows the camera's output.
Took me some time to get the NTSC up and running as well, transferring the fonts with hyper terminal or tera term didn't worked as i hoped.
If I get it working I'll let you know.


Grtz,
Title: Re: MAX7456 library update
Post by: K_onghena on Apr 02, 2014, 10:23 am
I forgot to mention:
osd.PALmode(); in setup :smiley-red:

Everything works now!!
Title: Re: MAX7456 library update
Post by: teoman on Feb 06, 2015, 08:38 am
would someone renew the library links given in that topic please. they all seem to be dead.
thanks.
Title: Re: MAX7456 library update
Post by: Avamander on Sep 01, 2015, 07:53 pm
Could someone please reupload the library?
Title: Re: MAX7456 library update
Post by: LiamOSM on Jun 20, 2017, 03:56 am
It seems like the original link to the library is dead. I've spent hours searching and I managed to find this:
https://www.tinyosshop.com/index.php?route=product/product&product_id=834 (https://www.tinyosshop.com/index.php?route=product/product&product_id=834)


At the bottom of the page is a link to download the library. I'm not sure if it's the most recent version of the library, but it works great for me.
Title: Re: MAX7456 library update
Post by: kg4wsv on Dec 28, 2017, 05:44 pm
new URL:  http://www.ece.uah.edu/~jdw/avr/MAX7456_lib.tar.gz (http://www.ece.uah.edu/~jdw/avr/MAX7456_lib.tar.gz)