'>Hextor_5IR.BSx '============================================================== '{$stamp BS2Sx} '============================================================== 'Debug program for testing IR training and comms 'To use the IR-link the receiver must first be trained to 'recognise the codes from your handset. 'See the 'Hextor-Manual, Documents, IR-Receiver'. ' 'New '--- 'Required knowledge: serin, &, serout..[dec..] ' debug (not vital but it helps) 'Constant: irrx 'Variable: irin 'Subroutine: irget '============================================================== epower con 2 'pin high turns on power to electronics irrx con 5 'pin infra red comms in, i96n Rled con 8 'pin high turns on right green led Lled con 9 'pin high turns on left red led i96n con 16624 '9600 baud, 8 bit, no parity, inverted poweruptime con 1500 'pause before powering up electronics irin var byte 'infra-red command 'during downloading the power to the electronics is turned off, 'if it is turned back on again too soon the electronics do not 'power up properly,so wait 1 second before turning power on. init: output Rled output Lled high Rled high Lled pause poweruptime high epower 'turn on electronics init1:gosub irget debug cls 'Program start '------------- start:toggle Rled pause 50 gosub irget debug hex2 irin,cr 'the upper nibble is a timing count which is not used 'the lower nibble is the IR code. '$F is the value during a keypress because the IR processor 'stops sending values while it is receiving an IR signal and 'irget returns a default value of 0 if serin times-out. goto start '------------- subroutines --------------------- irget:'listen to InfraRed co-processor irin =0 'set to idle value serin irrx,i96n,100,noir,[irin] 'valid 0 - 8 ' irin =irin & $F 'mask high nibble timing data noir: return '------------------------ end program -------------------------