First, I want to thank everyone for this thread. I have an Uno and MAX7456 breakout and it is working fine for writing to the screen.
I am having a problem which I can not seem to figure out. I want to count the number of frames and display the frame count on the screen. I am trying to use VSYNC as an interrupt,
but I can't get it working. I am a rank novice at this type of work and I could use some help.
Here are my connections:
Uno / MAX Breakout
D13 -> SCK
D12 -> DOUT
D11 -> DIN
D10 -> CS
D6 -> 1kOhm -> RST
D3 -> VSYNC
D3 -> 1kOhm -> +5v (added to solve vsync problem)
GND -> GND
+5v => +5v
I've also attached interrupt 0 (D3) => VSYNC through a 10kOhm as a debugging attempt.
Here is the sketch I have been working with:
// interrupt code based on work by Andrea Di Dato 2010
#include "MAX7456.h"
MAX7456 osd;
int enablePin = 6; // MAX7456 enable pin
volatile int VSYNC_count = 0; // count VSYNC
int intPin = 0; // interrupt pin
char st1[] = "000000000000"; // string representing frame count
void setup() {
// OSD (osd.write(string, position, line)
// hardware reset MAX7456
pinMode(enablePin, OUTPUT); // initialize enable pin of MAX7456
digitalWrite(enablePin, LOW); // disable chip
delay(1000); // delay to see the reset happen
digitalWrite(enablePin, HIGH); // enable chip
osd.begin(); // initialize OSD routine
osd.clear(); // redundant memory clear
attachInterrupt(intPin, CountVSYNC, FALLING); // attach interrupt
}
void loop() {
}
void PrintOSDFrame() {
osd.write_to_screen("Hello World", 1, 1); //write to row 1, column 1
itoa(VSYNC_count, st1, 10); // convert int to char strng
osd.write_to_screen(st1, 1, 10); //write vsync count to row 10
}
void CountVSYNC() { // Vsync interrupt function
VSYNC_count++; // increment vsync count
// noInterrupts();
PrintOSDFrame(); // call write to screen function
// interrupts();
}
This appears to never detect the vsync interrupt since no display ever gets written to the screen. If I move the three PRINTOSDFRAME lines to the loop, hello world and 0 are displayed.
I have tried a lot of different configurations, disconnected/reconnected, etc. and have gotten nowhere. I feel like I am missing something silly.UPDATE: I think I just found the something silly. Looking at the MAX7456 datasheet it indicates the vsync signal needs to be pulled high through a 1kOhm resistor. I'll give that a try tomorrow. I'll leave this note in here in case anyone else is interested in using the vsync.
UPDATE: Connecting the VSYNC to +5v through a 1kOhm resistor did fix the problem. I have updated the above note to indicate the problem was solved and to provide the correct connections for using vsync.