possible bug in hserout


Senior Member
I am working on the harware serial send/receive. I discovered some strange behavior - below is the code, running on a 28X1, firmware A.0:

<code><pre><font size=2 face='Courier'>
hsersetup B19200_4, %10 ' negative polarity; foreground receive

hserout 0, (&quot;Hello World!&quot;, cr, lf)

b0 = 90


hserout 0, (#b0, cr, lf)
sertxd (#b0, cr, lf)
inc b0
pause 300

goto myloop


The serial tx pin (IN6 on the Picaxe 28X1) is connected directly to my laptop's serial port. The 28X1 is running off Vcc=5V. On first glance, everything looks smooth - I can see the &quot;Hello world&quot; as well as the numbers appear on the terminal window in the programming editor (yes, I did move the cable to the hardware serial pins). But numbers 100 to 109 get printed wrong - the center &quot;0&quot; ios missing (i.e. &quot;17&quot; instead of &quot;107). Lower and higher numbers print fine. Also, the sertxd output doesn't have that behavior.

I also tried inserting a DS276 (similar to the standard Maxim tranceivers, but uses less (= no) external components, I'm hoping to produce a super-simple setup with that.) to invert and buffer the data (obviously the flag in hsersetup then changes from %10 to %00 and you have to add a &quot;high portc 6; pause 400&quot; before sending the &quot;Hello world&quot;. Still the same result.

Reducing the baud rate didn't help either.

Could anybody confirm that behavior? (Technical?).



Edited by - womai on 30/08/2007 19:23:08


Technical Support
Staff member
This is a small bug in the # output of a 'middle 0' in the hserout command we were not previously aware of, thanks for highlighting it. We have located the bug and will incorporate into next firmware release.

Apologies for any inconvenience, a workaround would be to manually convert byte to ascii characters before the hserout command.

serout and sertxd are unaffected.

Edited by - Technical on 04/09/2007 12:25:12