RGBLED xPL4Java Module V1.3
If you use the xPL4Java
framework, you
can install a RGBLED module that will allow you to control your RGBLED
controller board with xPL messages. The module is packaged in the
same Java .jar file as the RGBLED
Configurator.
NOTE: You must be running xPL4Java
V1.3 or later for this to work
The xPL Schema for the RGBLED adapter allows you to do everything the
RGBLED board supports. It would be helpful to be familiar with
the RGBLED control
protocol as
these most of this documentation discusses only the xPL messages and
such -- the details on what each command does are best understood from
the protocl documentation.
The xPL4Java RGBLED module introduces a new schema: RGBLED.basic. There is
also a CDP1802 plugin
file
(cdp1802 is the vendor ID all my xPL code is developed under) for folks
using xPLHAL to allow them to easily create scripts and determinators
to control the LEDs.
Because the RGBLED board requires a serial port to control and serial
ports are one thing Java does not natively support, there is a bit of
extra work you have to do the first time you use a Java program (like
this) that controls serial ports. The package is called Javacomm
and you can learn more
about it, where to download it and tips and notes on getting it
working here.
Once done, this should not ned
to be redone if you ever have any other Java serial port oriented
programs. My apologies, but it's out of my hands.
Once Java and the javacomm software is installed, download the
RGBLED xPL/Configurator file here
(including the
source) (tgz format). Once
downloaded and unzipped, just copy the jRGBLED.jar file
into your xPL4Java jars subdirectory and it should automatically
load.
Note: The supplied .jar file also houses a GUI based RGBLED
configurator program. You can learn more about that here
Next step is to configure it to tell it about the serial port (or
ports) you have RGBLED boards attached to. Use a configuration
tool like xPLHAL
or DCM.
If the RGBLED module is working, it should show
up under the xPL devices needing configuration. I'd suggest you
change the instance ID to something more memorable, then edit the
"SerialPort" parameter.
The RGBLED module can control boards on up to 16 ports at the same
time. One important note is that RGBLED messages are sent to all
ports, so you should insure that each board, regardless of which port
it's attached to, has a unique board ID.
Each SerialPort configuration item requires, at a minimum, two items --
the serial port name and the baudrate to use. For example, under
linux, this might look like
/dev/ttyS0,38400
Under Windows, it would be
COM1,38400
Note there is NO space between the items. Baud rates are the same
baud rates the board is described as supporting in the protocol.txt
file. In addition, two optional, additional parameters may be
specified. They are the inter-character delay and the
intercommand delay. These are normally 0 and 1 respectively and
represent the described delay when sending data to the RGBLED
controller in milliseconds. If you are using a baudrate less than
19200, you can probably change the inter-command delay to 0, but it
won't get you much and that one millisecond delay is a good saftey
margin.
Here is an example of disabling all delays:
/dev/ttyS0,1200,0,0
And here is one making this slower between commands
COM1,38400,0,10
(that is no delay between each character, 10 milliseconds between each
command).
You generally do not need to alter these delays, but if you do need to
do fine tuning, here they are.
Once you save the configuration, the RGBLED should immediatly open the
serial ports and be ready to accept xPL commands. If it does not
seem to send command over, insure you have the "javacomm" serial port
drivers installed properly and the baud rate you entered matches what
the board is set for.
The configuration information is automatically saved, so when the
xPL4Java container next starts and loads the RGBLED module, it will
immediatly open the serial ports you configured. You do not need
to visit the configuration for the service again, unless you need to
change the serial port setup.
Last updated June 12, 2006