UBW Play - Liberty Basic Program
For Firmware version D
Back to main UBW page
Screenshot of UBW Tester Basic Program
This is an application for Firmware D. It allows each pin of a UBW board (28 DIP or 28 SOIC) to be set to be an input or an output, and if the pin is an output you can set the bit high or low. It also constantly polls the UBW board to read every pin as an input and then reflects those states with little green LEDs. There is a pull down list to select the COM port that the UWB board is on - it is automatically refresshed every 5 seconds.

This code would be a good place to start if you are going to make a complex PC application for Firmware D, as it has some nice subroutines, including sending O, I and C commands and the serial port handling routines.

How It Works
The code works by watching for user clicks on the buttons, and issuing an "I" command to the UBW board every timer tick. This prompts the UBW board to issue a response "I" packet back to the PC with the current state of every pin. When a button is clicked, the new state of the pin is sent to the UBW board with a "C" packet (for changing direction of the pins) or an "O" packet to change the output value of the pin.

What's not in this version is the ability to recognize error bytes sent back from the UBW as it's processing packets, and the ability to do A/D readings.

One thing to note is that if you don't have the UBW connected to anything (i.e. its pins are floating) and they are set to inputs then the green LEDs will blink a lot as the PIC is reading the pins as random noise. Also, C0 and C1 are connected to the yellow and red LEDs respectively, and the default firmware D code slowly blinks C0 to indicate that it is connected and talking to the PC, so you'll see the LEDs on the PC reflect the state of the real LEDs.

A Zip file of all necessary files (basic source, LED bitmaps) - updated 2/23/09 to use example keypress handling code
Browse the files

The code is quite long, and includes many comments, so you can just download the zip file above rather than scroll through the code here.

Back to main UBW page
Questions? E-mail me at e-mail