[C.CC USERS] Plumbing serial interface on Arduino Uno
Steve Pretty
steve.g.pretty at btinternet.com
Thu Jan 20 21:41:31 GMT 2011
I have sorted out my problem with serial output from "Plumbing" programs
running on the Uno.
Matt suggested trying the serial.setup procedure on port 0 at 57600.
Although output appeared in occplug, it was not the expected character
stream. I tried a wide range of the normal Baud rates, with similar results.
Some googling revealed that there is an issue with the UNO. It seems
there is some bit rate doubler logic in the Atmel chip, which is turned
on by default in the UNO, but off in previous models (which have
different I/O hardware).
The trick is to set the arduino to run at half the speed you want it to
run at. Half of 57600 is 28800 - and when I tried that, all worked as
expected. Here is my test code, which tries all the serial.write PROCs.
#INCLUDE "plumbing.module"
PROC main ()
SEQ
serial.setup(TX0, 28800)
WHILE TRUE
SEQ
serial.write.string(TX0, "Hello World!*n")
serial.write.int32(TX0, #12345678)
serial.write.newline(TX0)
serial.write.int(TX0, #137F)
serial.write.newline(TX0)
serial.write.byte(TX0, #41)
serial.write.newline(TX0)
delay(1000)
:
An observation - the int and int32 PROCs produce output in hexadecimal.
They use lower case for a to f. occam requires uppercase - something
that might be worth changing?
Steve
More information about the users
mailing list