This page contains some notes on my initial usage of NetMedia's
BasicX BX24 processor. This is an Atmel-based
microprocessor board that runs NetMedia's flavor of Visual Basic.
Text Editor Replacement
The text editor supplied with the BasicX IDE is poor, as it does not even support undo operations.
I therefore found a freeware editor to use in place of it. From this editor I can edit,
compile and download VB code to the BX24. Pdf document explaining this can be found
Execution Speed and the COM3 Serial Port
The BX24 supports multitasking. The operating system will allocate fixed time slices of
approximately 1.95ms (based on an interrupt frequency of 512hz) to tasks. There are however
many special situations that can affect the time slices allocated and context switching.
My first use of this processor is for strobing a lamp matrix. There will be two subtasks
involved. The main task will strobe the lamps based on the current lamp states (on or off).
The other task will receive serial commands from another microprocessor (Basic Stamp 2) and
will update the lamp state data for the strobing subtask.
I have not at this point run my code with all hardware hooked up, however I believe it is
essentially complete. Having read on the BasicX Yahoo newsgroup that the speed of code slows
down with serial port COM3 open, I decided to do a quick test to see how much this would
slow my strobing code down.
The test I did was pretty simple to implement: every n strobing loops, flash the on-board
green LED. I can then visually determine the amount of time to execute the n strobing loops.
I performed this test with the serial task both enabled and disabled. With the serial task
enabled, I also tried different baud rates to see what effect that would have. The results are
tabulated below. Note that the maximum speed of COM3 is 19200 baud.
|Baud Rate ||Serial task |
|4800 ||33 ||24|
|9600 ||40 ||24|
|14400 ||49 ||24|
|19200 ||80 ||24|
All times above are in seconds, and represents the time to strobe the lamp matrix 5000 times.
The actual work performed is probably not too important. None of the lamp strobing commands
does anything complicated. There are no PULSEOUT commands or anything that would cause
task locking, etc.
As the COM3 baud rate increased, the time it took to complete the strobing
loops also increased. The time increase for 19200 was substantial over 14400, and double
that of the 9600 test. In all cases, having the COM3 port open resulted in a slower strobing
rate than not having the COM3 port open.
In practical terms for me, if I set the baud rate at 4800, I can strobe at 151hz (5000/33).
But at 19200 I can only strobe at 62hz (5000/80). For lamp strobing, 62hz is adequate to avoid
flicker, but higher rates would be better. I would thus try and limit the port baud rate
to 14400, giving me a strobe frequency of 102hz (5000/49).
Of course other techniques could be used. I could use an interrupt mechanism and only open the
COM3 port when an interrupt is received. With the COM port closed I may obtain a strobing
frequency of 208hz (5000/24). But I haven't tested the overhead of waiting for the interrupt.
Once I have the lamps actually hooked up and running for real I can make a determination on
what needs to be done.
Conclusions and Recommendations
If you need to do multitasking like this and speed is an issue, consider carefully the
COM3 port baud rate you use. Do you really need 19200? Or us the faster COM1 port if possible.
Caveat: I am new to the BX24 and may be ignorant of many things, so don't take anything here
as gospel - test things out for yourself.
Last updated: September 26, 2008