|
LEGO MindStorms Remote Control Serial ProtocolThe LEGO MindStorms remote is a battery-operated, hand-held infrared remote control that can command an RCX to start and stop programs, run motors, and respond to three of the one-byte messages implemented by the standard RCX firmware. Even if the RCX is running a program, the motors can be controlled from the remote. Any motor commands will temporarily override the program's current motor settings. As soon as the RCX receives (or assumes) the "all buttons released" command from the remote the motors will resume their current programmed state, and if no program is running all motors will stop. The remote has sixteen buttons which can be pressed simultaneously in any combination. Whenever one or more buttons is held down, the remote transmits data packets containing a bit field that indicates the state of all sixteen buttons. After the last button is released, the remote sends one final packet containing all "0" bits to indicate that no buttons are pressed. The RCX does not acknowledge the remote's command packets, and if it does not receive valid packets continuously, it will assume "all buttons up" after a short interval. The RCX will not recognize the infrared remote protocol until after the factory firmware file (either firm0309.lgo or firm0328.lgo) has been downloaded. It should be noted that some replacement RCX firmwares implement their own interpretation of the buttons on the remote. The remote's packets always adhere to the following format, where "~" indicates taking the 1's complement of a byte value:
The data in the packet is a 16-bit value (msb/lsb) containing a "1" bit for each button that is pressed at any given time. The checksum byte, chk, is formed the same as for other RCX packets. A key value of 0x0000 indicates that all keys have been released. You form the msb/lsb by ORing together the bits for each button that is held down:
The remote uses the same 2400-Baud RS-232 communications settings as used by the RS-232 IR tower with the standard MindStorms RIS 1.0 software. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright (c) 2003 by Christopher Phillips. All Rights Reserved. LEGO® is a trademark of the LEGO Group of companies, which does not sponsor, authorize, or endorse this site. |