^39 - The IR Port
This port is a read only value of the last IR action received by a D4 sensor.
It only reports the last change as either a press or release.
The value is a bitfield with the MSB (bit 8) as the state and the first 7 bits as the IR button number.
MSB cleared indicates the IR button is pressed. MSB set indicates the IR button is released. Therefore IR button 1 release is 0x81, IR button 11 release is 0x8b etc.
This port is not implemented in D5 sensors. (DUS360cr, DUS90, etc.) |
Syntax
LDA ^39,0 will give the last transition of IR buttons 1-12.
LDA ^39,1 will give the value of the dipswitch on the custom coded remote.
This only reports the last button action not the current state of all IR buttons. |
Button Number |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
Press Value |
0x01 |
0x02 |
0x03 |
0x04 |
0x05 |
0x06 |
0x07 |
0x08 |
0x09 |
0x0a |
0x0b |
0x0c |
Release Value |
0x81 |
0x82 |
0x83 |
0x84 |
0x85 |
0x86 |
0x87 |
0x88 |
0x89 |
0x8a |
0x8b |
0x8c |
Examples
Example showing one task managing multiple buttons.
Task1()
{
LDA ^39,0 // Get the keyboard port
CMP #0x01 // Was it a button 1 push?
BRZ B1PRESS // Yes, go do button 1 press stuff
CMP #0x81 // Was it a button 1 release?
BRZ B1RELEASE // Yes, go do button 1 release stuff
CMP #0x02 // Was it a button 2 push?
BRZ B2PRESS // Yes, go do button 2 press stuff
...
}