Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / |= please help! on: May 17, 2013, 11:16:52 pm
I'm doing some timer stuff, and I dont understand this opperator...  |=
Here's what I'm seeing...


nevermind the logic, but what does the opperator mean?  What is the difference between = and |=
2  Development / Other Software Development / Re: MAX7456 library update on: February 26, 2012, 03:06:28 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.
3  Development / Other Software Development / Re: MAX7456 library update on: February 26, 2012, 08:18:13 am
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:

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

  _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:
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:
osd.println("Stuff for the left screen");

osd.println("Stuff for the right screen");
4  Development / Other Software Development / Re: MAX7456 library update on: February 18, 2012, 01:31:20 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.
5  Development / Other Software Development / Re: MAX7456 library update on: February 16, 2012, 06:13:13 pm
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.
6  Development / Other Software Development / Re: MAX7456 library update on: February 16, 2012, 12:04:11 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.
7  Development / Other Software Development / Re: MAX7456 library update on: February 08, 2012, 10:52:13 pm
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.
8  Using Arduino / Project Guidance / Where can I upload my arduino lib to the web? on: February 08, 2012, 10:08:05 pm
Is there a place to upload arduino libraries to the web?  Or does everyone just find their own spot?
9  Development / Other Software Development / Re: MAX7456 library update on: February 02, 2012, 09:09:22 pm
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.
10  Development / Other Hardware Development / Re: Creating libraries for different Adruino's on: January 24, 2012, 12:51:51 am
That looks perfect for what I'm gonna be doing.  Thanks a lot!
11  Development / Other Hardware Development / Creating libraries for different Adruino's on: January 23, 2012, 01:37:30 am
I may not be posting this in the right place, but I think someone here can help me.  I'm working on updating a library, and I would like to know how to write a condition based on what arduino board I am using.  I want my library to be able to work with several arduino models, depending on what "Board" is selected in Arduino IDE.  How is this possible?  And, is it possible to have Arduino IDE automatically select the correct H file, depending on that "Board" selection?  Any advice is welcome.
12  Development / Other Software Development / Re: MAX7456 library update on: January 22, 2012, 06:18:27 pm
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?
13  Development / Other Software Development / Re: MAX7456 library update on: January 12, 2012, 10:17:44 pm
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. 
14  Development / Other Software Development / Re: MAX7456 library update on: January 11, 2012, 10:38:08 pm
Well, that gives me something to look into.  Any ideas about the video going in and out every few seconds?
15  Development / Other Software Development / Re: MAX7456 library update on: January 11, 2012, 09:08:09 pm
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
#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!
Pages: [1]