|
楼主
查看: 5483回复: 1
发表于 2020-1-2 14:29:39
只看该作者
void PS2_ReadData(void)
{
volatile u8 byte=0;
volatile u16 ref=0x01;
CS_L;
PS2_Cmd(Comd[0]); //¿ªÊ¼ÃüÁî
PS2_Cmd(Comd[1]); //ÇëÇóÊý¾Ý
for(byte=2;byte<9;byte++) //¿ªÊ¼½ÓÊÜÊý¾Ý
{
for(ref=0x01;ref<0x100;ref<<=1)
{
CLK_H;
DELAY_TIME;
CLK_L;
DELAY_TIME;
CLK_H;
if(DI)
Data[byte] = ref|Data[byte];
}
delay_us(16);
}
CS_H;
}
|
|