koolguy
Active Member
Hi,
I want to interface PS2 with pic16f877a i have seen my link in Google but i am suck with code how to do this...the ps2 has been tested in terminal window it was sending different ascii/hex number for different keys.
please tell for half duplex communication i.e. Device to Host.
i was trying using this..
For testing code i have connected two switch on board for clk and data rather than connecting ps2 it self..but the serial window does not show the data enter from switch as i want...at while it wait for clk to 0 for starting and after 0 it run for loop ....then the process go on unnecessary.
1 start bit. This is always 0.
8 data bits, least significant bit first.
1 parity bit (odd parity).
1 stop bit. This is always 1.
I want to interface PS2 with pic16f877a i have seen my link in Google but i am suck with code how to do this...the ps2 has been tested in terminal window it was sending different ascii/hex number for different keys.
please tell for half duplex communication i.e. Device to Host.
i was trying using this..
Code:
unsigned char Data=0,temp;
while(CLK==0); //Wait for First Falling Edge
for(char i=0;i<7;i++)
{
while(CLK==0); //Capture the next 7 bits of data
temp=RC0;
temp<<=i;
Data|=temp;
}
For testing code i have connected two switch on board for clk and data rather than connecting ps2 it self..but the serial window does not show the data enter from switch as i want...at while it wait for clk to 0 for starting and after 0 it run for loop ....then the process go on unnecessary.
1 start bit. This is always 0.
8 data bits, least significant bit first.
1 parity bit (odd parity).
1 stop bit. This is always 1.