TVout library interferes with my interrupts

Hi, I'm trying to use the Arduino Mega 2560 with a PS/2 keyboard and the TVout library.

Below you can see that I attached an interrupt to pin 19 which is the clock signal from the keyboard, then set pin 25 to input for the keyboard data, then I started TVout.

void setup() {
  attachInterrupt(digitalPinToInterrupt(19), keystroke, FALLING);
  pinMode(25, INPUT);
  TV.begin(_NTSC,128,96);
  TV.select_font(font6x8);
  TV.println("Keyboard v3.0\nTerminal\n");
}

The interrupt runs this function:

void keystroke() {
  buff[bit] = digitalRead(25); //reads current bit from keyboard
  bit += 1; //advances for next bit
}

The problem is that when the Arduino is receiving data from the keyboard, the video output starts glitching and keystrokes don't register properly. Is there some way I could somehow disable video output before reading data? Or something else. Thanks in advance!

Have you checked to be sure the TV library is not blocking your code when it uses interrupts?
Paul

The TV library does block out my code whenever it triggers the H-SYNC, so I'm just trying to figure out how to prevent it from missing bits.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.