General
If you have a UBW board with firmware C loaded onto it, then this page
is for you. Firmware C is a very simple application that started as the
Microchip CDC demo code (virtual serial port). I modified it to run on
the UBW hardware, and to take data from the USB and output it on Port
B. This is the most basic firmware build.
How It Works
For Windows PCs, the first time you plug in a UBW with firmware C, it
will ask you for an .inf file. You need to use tell it to use this .inf
file. Then Windows will create a virtual serial (COM) port for the
UBW.
You can find out which COM port was assigned to the UBW by going into
the device manager (Start->Settings->Control Panel->System,
Hardware tab, Device Manager button) and looking under "Ports (COM
& LPT)". For Macs and Linux boxes, there are other ways to discover
which serial port the UBW is listed under - when I figure those out
I'll put them up here.
So now you have a UBW that appears as a serial port. You can use any
language you want (I recommend Liberty
Basic) to write a little program
to output bytes to that serial port. Or you could use Hyperterm (comes
with Windows) just to see if it works. Each byte that you send will
appear on pins B7 through B0 on the UBW. You can plug in your UBW to a
bread board and put some LEDs on port B to see it work.
Update (07/17/06)
A new version of Fimrware C (version 1.0) is now released. The only
major change is
that every time you send a byte to the UBW, it will read Port A (they
are all inputs in Firmware C) and send you the value of the port back.
So every time you send a byte, you'll get a byte. You can ignore them
if you want, but if you need some simple inputs they can be very useful.
Update (08/11/06)
A slightly modified version of Firmware C v1.0 has been released. It is
identical to version 1.0 except that when you write a byte to Port B,
all of the bits' positions are reversed. In other words, Port B pin 0
is now the highest bit in the byte you send it, Port B pin 7 is the
lowest bit you send it, etc. This was made for Bruce's Bits To Bytes
class because of existing hardware requirements. You can download the
special HEX file here.
(right click on the link and do save-as to get the HEX file.)
Files:
You can download the project files, sorce code, and HEX files here.
Notes
- When you use Firmware C, the yellow LED (L2) will stay off until
it has established a connection with the PC. Then the yellow LED will
blink slowly.
- For each USB packet (byte) you send, the red LED (L3) will toggle
its state. That's how you know that information is reaching the UBW -
the red LED will blink.
- It is a white lie that every byte is output onto Port B
(B7->B0). What really happens is that the first byte of every USB
packet is output. In reality, most languages (and all terminal
emulators like Hyperterm) put each byte in a seperate USB packet (in
essense) and so the distinction is irrelevant. However, in Liberty
Basic 3.02 and up, if you do a print command to the COM port with more
than one character in the printed string, only the first byte will
appear on Port B because LB is putting all of the bytes of the string
into _one_ USB packet. (Up to the packet limit of 64 bytes.)
- Because each USB packet will only contain one byte of usefull
information, the overhead is high and the maximum speed at which you
can get bytes out to the UBW is limited to about 300/s.
- If you plug your UBW into a different USB port, your PC may
assign a different COM port address to the virtual serial port. Make
sure you check which COM port it appears as if you ever change the USB
port you plug it into.
- The first byte you send to the UWB (after reset) will cause it to
send back it's current version string, which is now "UBW Firmware C
v1.0". You should know to ignore this if you are planning on using the
bytes that come back from the UWB, or use it to know which firmware
version you have loaded.
- Firmware C initalizes port B to all outputs with every bit high
on reset.