Hi,
Are you ready to build the Lookuptable and conditions that goes with?
if so, here's something that may work.
Code:
SCLK VAR PORTC.1
SDATA VAR PORTC.0
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 10 ' 115200 Baud @ 20MHz, -1.36%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
Key var WORD
CounterBit var byte
MainLoop:
gosub readps2
HSEROUT [#KEY,", "]
goto mainloop
ReadPS2:
FOR COUNTERBIT=0 TO 10
WaitFallingEdge: if sclk then waitfallingedge
KEY.0[COUNTERBit]=SDATA
WaitRisingEdge: if sclk=0 then waitrisingedge
NEXT
KEY=(KEY>>1)&$ff
pauseus 50
return
http://www.hw-server.com/docs/PS2_port1.html
Last edited by mister_e; - 11th March 2007 at 18:25.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks