'--------Title-------- ' File......keyless_entry.pbp ' Started....6/20/06 '----------Initialization--------- OSCCON = %01101010 'Sets internal oscillator TRISB = %00001100 'Sets PortB pins 2,3 to inputs 'the rest to outputs PORTB = 0 'Sets PortB pins to low start: if portb.2 = 1 then goto lock 'If left button is pressed goto 'subroutine lock if portb.3 = 1 then goto unlock 'If right button is pressed goto 'subroutine unlock goto start lock: 'Subroutine lock serout 7,4,[68,1] 'Transmits the serial IR signal '"lock" to door. The first byte is '68 and the last is 1. high 4 'Bi-colored LED is red low 5 serout 7,4,[68,1] 'Transmits "lock" again serout 7,4,[68,1] 'Transmits "lock" again pause 100 'Pauses for 100 miliseconds goto start unlock: 'Subroutine unlock serout 7,4,[68,2] 'Transmits the serial IR signal '"unlock" to door. The first byte 'is 68 and the last is 2. high 5 'Bi-colored LED is green low 4 serout 7,4,[68,2] 'Transmits "unlock" again serout 7,4,[68,2] 'Transmits "unlock" again pause 100 'Pauses for 100 miliseconds goto start