Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

reading data at the falling edge of the clock

Status
Not open for further replies.

triple_e

New Member
HELLO

I am trying to read data from a PS2 device. The PS2 device has a clock and data line being interfaced with the PIC. The PS2 device always generates the clock ( high) . The clock line have to controlled by the PIC i.e clock have to be brought high and low for a period of 50 microseconds . The PS2 port has serial transmission protocol with one start bit , 8 data bits and one stop bits. SO I have to read the 8 data bits at the falling edge of each clock pulse.

My question is how to use the interrupt to read data at the falling edge once the timer has overflowed. Can anyone help in this either by giving me a sample code or guiding me.
thanks.
 
triple_e said:
HELLO

I am trying to read data from a PS2 device. The PS2 device has a clock and data line being interfaced with the PIC. The PS2 device always generates the clock ( high) . The clock line have to controlled by the PIC i.e clock have to be brought high and low for a period of 50 microseconds . The PS2 port has serial transmission protocol with one start bit , 8 data bits and one stop bits. SO I have to read the 8 data bits at the falling edge of each clock pulse.

My question is how to use the interrupt to read data at the falling edge once the timer has overflowed. Can anyone help in this either by giving me a sample code or guiding me.
thanks.

EPE did an article on PS2 mouse any keyboard, you can download the PIC software for a simple mouse driven game at **broken link removed**, and the software from the original article is at **broken link removed**. If you want a back order copy?, it was in August 2004, it and should answer ALL your questions.

Both a mouse and a keyboard are bi-directional (although a mouse is far more so!), with the transmitter providing the clock pulses.
 
If the PIC is generating the clock, no meaning of generating the interrupt at falling edge, make clock high, read the data pin, make clock low and so on...

If the device is controlling the clock you need to use external interrupt or capture interrupt confgured for falling edge.
 
triple_e said:
HELLO

I am trying to read data from a PS2 device. The PS2 device has a clock and data line being interfaced with the PIC. The PS2 device always generates the clock ( high) . The clock line have to controlled by the PIC i.e clock have to be brought high and low for a period of 50 microseconds . The PS2 port has serial transmission protocol with one start bit , 8 data bits and one stop bits. SO I have to read the 8 data bits at the falling edge of each clock pulse.

You have to give some more information in order for us to help you.

What PIC are you using? How are you connecting to the "PS2 device" which lines (clock and data) go to which pin on the PIC? ... blah...blah....


My question is how to use the interrupt to read data at the falling edge once the timer has overflowed. Can anyone help in this either by giving me a sample code or guiding me.
thanks.

A rather cryptic question which I can answer with another question. Are you sending the clock to a timer input? BTW, there are PICs that have an edge triggered interrupt input (RB0) and so you don't have to use the timer to do this.

For now, all I can say is go use google. There are plenty of code samples for "PIC PS2 keyboard".
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top