Ir Help
Cenlasoft
Posts: 265
I can't figure out whats wrong, Please help.
' Homemade IR Remote
'
' Device Settings
'
DEVICE········· SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ··········· 4_000_000
'
' IO Pins
'
IrLED······ VAR···· RA.0
'
' Constants
'
start_bit ·con ·1
stop_bit ·con ·4
bin_0 ··con ·2
IrMod··CON·38000···' modulation freq = 38 kHz
bin_1 ··con ·3
between_pulses ·con ·2
counter ·var ·byte
IR_message ·var ·byte
duration ·var ·byte
'
' Interrupt
'
IR_message = 25
' =========================================================================
· PROGRAM Start
' =========================================================================
'stop
'
' Program Code
'
Start:
Main:
freqout IrLED, IrMod, start_bit
pause between_pulses
for counter = 0 to 7
duration = 2 + IR_message.lowbit(counter)
freqout IRLED,IrMod,duration
pause between_pulses
next
freqout IRLED,IrMod,stop_bit
goto Main
Thanks,
Curtis
' Homemade IR Remote
'
' Device Settings
'
DEVICE········· SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ··········· 4_000_000
'
' IO Pins
'
IrLED······ VAR···· RA.0
'
' Constants
'
start_bit ·con ·1
stop_bit ·con ·4
bin_0 ··con ·2
IrMod··CON·38000···' modulation freq = 38 kHz
bin_1 ··con ·3
between_pulses ·con ·2
counter ·var ·byte
IR_message ·var ·byte
duration ·var ·byte
'
' Interrupt
'
IR_message = 25
' =========================================================================
· PROGRAM Start
' =========================================================================
'stop
'
' Program Code
'
Start:
Main:
freqout IrLED, IrMod, start_bit
pause between_pulses
for counter = 0 to 7
duration = 2 + IR_message.lowbit(counter)
freqout IRLED,IrMod,duration
pause between_pulses
next
freqout IRLED,IrMod,stop_bit
goto Main
Thanks,
Curtis
Comments
You can isolate the bit like this:
I've busted things into subroutines to help you conserve program space.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
temp2=2 + temp1.0
instead of
temp2=temp1 & $01
temp2=temp2 + 2
It is legal to add a bit to a bytevar.
Bean.