'**************************************************************** '* Name : IR675.BAS * '* Author : Craig S Gardner * '* Notice : Copyright (c) 2003 * '* : All Rights Reserved * '* Date : 10/3/2003 * '* Version : 1.0 * '* Notes : * '* : * '**************************************************************** @ DEVICE INTRC_OSC, MCLR_off, PROTECT_OFF, WDT_OFF CMCON = 7 ' Comparators OFF ANSEL = 0 ' A/D OFF -- Port pins all digital TRISIO = %010000 ' All I/O but GPIO3 = outputs GPIO = %00000000 ' All 0 on boot Define OSCCAL_1K 1 ' Set OSCCAL for 1K device IRpulse_length var word(13) xx var Byte Command Var Byte clear Getstartbits: PuLSIN GPIO.4,0,IRpulse_length(0) if IRpulse_length(0) < 200 then goto getstartbits Endif for xx=1 to 12 pulsin GPIO.4,0,IRpulse_length(xx) next xx displaybits: if IRpulse_length(1) < 100 then Command.bit0 = 0 Else Command.bit0 = 1 endif if IRpulse_length(2) < 100 then Command.bit1 = 0 Else Command.bit1 = 1 endif if IRpulse_length(3) < 100 then Command.bit2 = 0 Else Command.bit2 = 1 endif if IRpulse_length(4) < 100 then Command.bit3 = 0 Else Command.bit3 = 1 endif if IRpulse_length(5) < 100 then Command.bit4 = 0 Else Command.bit4 = 1 endif if IRpulse_length(6) < 100 then Command.bit5 = 0 Else Command.bit5 = 1 endif if IRpulse_length(7) < 100 then Command.bit6 = 0 Else Command.bit6 = 1 endif if IRpulse_length(8) < 100 then Command.bit7 = 0 Else Command.bit7 = 1 endif If Command.bit7 = 0 then 'Bit 7 is one of the device bits Command = Command + 1 Endif If Command = 10 then Command = 0 Endif SEROUT GPIO.0,2,[Command] pause 100 goto Getstartbits