Pages: 1 [2] 3 4   Go Down
Author Topic: MAX7456 library update  (Read 14702 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

NTSC or PAL?

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

-j
Logged

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. 
Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is a link to the code I posted previously.

Here is the schematic:


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:



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:
#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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!!!!!
Logged

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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
Logged

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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.
« Last Edit: February 16, 2012, 06:22:30 pm by btmcmahan » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Texas
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

 
Logged

Pages: 1 [2] 3 4   Go Up
Jump to: