Remote Control Encoder
HOW TO MAKE IR ENCODER USING SX28.
Post Edited By Moderator (Bean (Hitt Consulting)) : 6/5/2007 5:31:07 PM GMT
Post Edited By Moderator (Bean (Hitt Consulting)) : 6/5/2007 5:31:07 PM GMT
Comments
EDIT: I've attached an untested program to get you started.
EDIT #2: I've updated the program to add an ISR-based frame timer so that the frame timing can be consistent, regardless of the value(s) transmitted.
Post Edited (JonnyMac) : 6/5/2007 6:43:26 PM GMT
Dan
' Use: Tx_SIRCS irWord
' -- transmit 12-bit (device + command) SIRCS code
' -- sends three frames
SUB Tx_SIRCS
tmpW2 = __WPARAM12 ' capture code
FOR tmpB1 = 1 TO 3 ' send three frames
' start bit
IrAnode = IR_ENABLE ' activate IR LED
Delay MS_24 ' wait 2.4 ms
IrAnode = IR_DISABLE ' deactivate IR LED
Delay MS_06 ' wait 0.6 ms
' clock the bits, LSB first
tmpW3 = tmpW2 ' make copy of ir word
FOR tmpB2 = 1 TO 12 ' send 12 bits
IrAnode = IR_ENABLE ' activate IR LED
IF tmpW3.0 = 1 THEN ' if 1
Delay MS_12 ' wait 1.2 ms
ELSE ' otherwise
Delay MS_06 ' wait 0.6 ms
ENDIF
IrAnode = IR_DISABLE ' deactivate IR LED
Delay MS_06
tmpW3 = tmpW3 >> 1 ' get next bit
NEXT
Delay_MS 33 ' pad for ~45 frame time
NEXT
ENDSUB
What part of it doesn't make sense ?
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
IrAnode = IR_ENABLE ' activate IR LED
IF tmpW3.0 = 1 THEN ' if 1
Delay MS_12 ' wait 1.2 ms
ELSE ' otherwise
Delay MS_06 ' wait 0.6 ms
ENDIF
IrAnode = IR_DISABLE ' deactivate IR LED
Delay MS_06
tmpW3 = tmpW3 >> 1 ' get next bit
NEXT
Delay_MS 33 ' pad for ~45 frame time
NEXT
WHAT IS VALUE 12-BIT DATA TRANSMIT (dEVICE + COMMAND)?
What you'll want to look for, specifically, is information on Sony's 12-bit protocol; the lower seven bits are called the command code, the upper five bits are called the device code; you have to load a word with the appropriate bits before transmitting. The receiver code you cited (which I also wrote when I worked for Parallax) expects to receive 12 bits and splits them into the LSB and MSB of the return value.
Only Parallax would make all their books free downloads...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·