In the code below, is there some logic to the apparent discrepancy between the nomenclature for I/Os in "if then" statements versus "irout" statements? I would like to understand the rationale rather than just remember which I/Os are handled each way. Thanks.
Code:
' IR Out Code Sample
' Infrared LED on pin C.0
' Momentary N.O. switches on pins C.1,C.2,C.3,C.4
#picaxe 08m2
#no_data
main: ' Wait until switch is pressed
if pinC.4 = 1 then tx_a
if pinC.3 = 1 then tx_b
if pinC.2 = 1 then tx_c
if pinC.1 = 1 then tx_d
goto main
tx_a: 'Load desired SIRC code into b1.
let b1 = 0 ' Code 0
goto tx_ir
tx_b:
let b1 = 1 ' Code 1
goto tx_ir
tx_c:
let b1 = 2 ' Code 2
goto tx_ir
tx_d:
let b1 = 3 ' Code 3
goto tx_ir
tx_ir: 'Transmit SIRC code multiple times to increase reliability.
for b2 = 1 to 2 ' Send code 2 times.
irout C.0,1,b1 ' Send device code 1 followed by contents of b1.
pause 45
next b2
goto main