ColorPAL documentation
© Parallax, Inc. • ColorPAL (2009.06.15) Page 5 of 12
Programming
Communication with the ColorPAL takes place using serial I/O, transmitting and receiving at between
2400 and 7200 baud, using a non-inverted, open-drain protocol. The ColorPAL includes a pullup
resistor to Vdd, so you do not need to apply one externally. Because of the open-drain protocol,
the pin
used to communicate with the ColorPAL should always be configured as an input, except when being
driven low.
Also, when starting up, you should wait for this pin to be pulled high by the ColorPAL before
trying to send it any commands. This is particularly important when connecting it to one of the BOE’s
servo headers, since the three-way power switch will start your PBASIC program before powering up the
ColorPAL.
The pin and baudmode settings for the BS2 on pin 15 at 7200 baud, for example, would be:
sio PIN 15
baud CON 119 + 32768
The ColorPAL has several modes of operation:
• Direct: Commands are received and executed immediately.
• Buffering: Commands are received and buffered for future execution.
• Executing: Commands which were buffered and/or saved in EEPROM are being executed.
There are three different ways to reset a ColorPAL:
• Powerup: When first powered up, the ColorPAL begins executing the commands saved in its
internal EEPROM at location 00. In a new, unprogrammed ColorPAL, this program simply exits
into Direct mode.
• Short Break: A low logic level applied for about 7 milliseconds will reset the ColorPAL and begin
execution as above for Powerup.
• Long Break: A low logic level applied for 50 milliseconds or more will reset the ColorPAL and
enter Direct mode. This is the only way to grab the ColorPAL’s attention when it’s running a
program.
Here is an example of a reset routine that will always cause the ColorPAL to enter Direct mode:
Reset:
LOW sio 'Pull sio low to eliminate any residual charge.
INPUT sio 'Return pin to input.
DO UNTIL sio : LOOP 'Wait for pin to be pulled high by ColorPAL.
LOW sio 'Pull pin low.
PAUSE 50 'Keep low for 50ms to enter Direct mode.
INPUT sio 'Return pin to input.
PAUSE 10 'Pause another 10ms
RETURN