Intercepting a synchronous signal

Hi
I'm having some trouble with my last project: I want to read a clocked signal (data+clock) using interrupts, but due to my little competences I am still having troubles.

The signal is sent in 11-bit packets (8+3), I need to "intercept" them and then transform the data into bytes.
There are no libs for this (and little instructions for using interrupts).

Thank you! XD

p.s.: I'm a newbie :stuck_out_tongue:

I am still having troubles

And they are..?

You'll have to supply the details of the protocol - i.e. data clocked on rising or falling edge, what the "8+3" represent etc.

Well, the protocol is PS/2. :stuck_out_tongue: (Yes, I am trying to build a key sniffer)
Falling edge, I think.
1 start bit, 8 data bits, parity and end, if I remember.

The problem is that I don't know how to use interrupts to capture data.
I found a library, but it doesn't work with recent keyboards (in "sniffer" mode), probably because of the PC, which is connected too.
So I am trying to start from zero, so I can have a better control on the library, and without having functions I don't need.

Already tried a disassembly of the ps2keyboard library with little success (I break at the interrupt process)

Thank you for the help!

The problem is that I don't know how to use interrupts to capture data.

You set the interrupt to trigger on the appropriate edge of the clock line, and sample the data line in the interrupt service routine.

If you post the code you've got, it is easierto see what is the matter.

This is the library.
http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html

All I need is a good guide on how to use interrupts/isr

What problems are you having with the code that you have got?

Maybe you can use this library code or figure out how is does it and write your own?

http://arduino.cc/playground/Main/PS2KeyboardExt2

retrolefty:
Maybe you can use this library code or figure out how is does it and write your own?

Arduino Playground - HomePage

That's the point. I want to rewrite the library (I know it's not easy), for having a better control on the code. And because the ps2keyboard library is NOT for intercepting, but it has to be directly connected to the keyboard. Some work and some does not, when the pc is working.

I need to know how to make a working ISR for capturing data with interrupts.

1 start bit, 8 data bits, parity and end, if I remember.

If that is the format of your data then it is not synchronous data, you don't get start bits in synchronous data. That is asynchronous data and what is more it is a NRZ code (none return to zero) so you can't use just interrupts to read it.

AWOL told you how to use interrupts if it is synchronous data and you have two signals.

Looks like a useful reference:
http://www.computer-engineering.org/ps2protocol/