0

I'm currently reading values from a PS/2 mouse, which is working perfectly! - I'm trying only to read from the mouse, when the mouse sends a clock signal (falling edge), so i'm trying to use a interrupt. This is some of my code so far:

Interrupt handler:

extern struct mouse mouseData;
CY_ISR(PS2_interrupt) { 

    ISR_getMouseData(&mouseData);

}

This interrupt is giving me the follwing result, which is perfect: enter image description here

I'm moving the mouse to the right, and it's outputting the right thing, i can't however do anything in the main for loop. If i for instance print something on the display in the main loop, nothing happends, but it can still read data from the mouse, whenever the mouse is sending..

I found out that you should clear the interrupt using this function:

isr_PS2_clock_ClearPending()

When i write this function in the interrupt handler i'll get this: enter image description here

This is the same movement at before, but as you can see, the data i corrupted. I can however execute things in the main loop, whenever the intterrupt is not called.

What am i doing wrong in terms of handling the interrupts?

1 Answers1

0

Try to use isr_PS2_clock_ClearInterrupt() to clear the Flag

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109