28x2 sertxd to terminal @ setfrq em40

BCJKiwi

Senior Member
Would it be possible to make the baud rate for sertxd/serout adjustable (as it is for hserout).

I am aware that the sertxd baud rate is tied tothe clock speed but does it have to be?

When running a 28x2 @ setfreq em40 (10MHz resonator) am unable to use sertxd at the standard baud rates but this is possible with hserout.

However for debugging etc sertxd is required and can't be used as the baud rate for sertxd is automatically set to 48000 baud (at 40MHz), a setting which cannot be matched in the PC!
 

hippy

Senior Member
The baud rates for SERIN, SEROUT, SERRXD and SERTXD are all fixed in firmware. It is potentially possible to increase the number of baud rates but that would require additional firmware space and, considering the baud rates required in this case, those would only ever be of use to those using a PICAXE at 20MHz or 40MHz.

The easiest option is to use the AXE027 download cable as this will operate at 48000 baud. If viewing SERTXD within Programming Editor Terminal, simply select Non-Standard Baud rate then 48000.

If needing a standard baud rate then the simplest approach is to use SETFREQ M8 before the SERTXD and SETFREQ EM40 after. This will however affect background timmings, PWMOUT, HSERIN etc.

Another alternative is to use a second PICAXE ( 28X2 is best for the large scratchpad size ) which takes 48000 baud serial in via HSERIN background receive and emits it at a standard baud rate. That's probably the approach I would take if doing a lot of PICAXE work at 40MHz ...

#Picaxe 28X2
#No_Table
#No_Data
#Terminal 9600

Symbol B48000_8 = 41
Symbol B48000_16 = 83
Symbol B48000_32 = 166
Symbol B48000_40 = 208
Symbol B48000_64 = 333

HSerSetup B48000_8, %111
Do
If ptr <> hSerPtr Then : SerTxd( @ptrInc ) : End If
Loop
 

BCJKiwi

Senior Member
@EC
The non standard speed does not work in this case as PE can't set 480000 baud as it is not an available speed in the OS for the serial port on the PC.

@Hippy
As this is just for debugging, have tested the setfreq down speed / up speed and it works fine - now why didn't I think of that? - maybe something to do with a mental block assuming that once the resonator was installed then m8 wouldn't work?
Oh well, maybe I'll remember next time.

Thanks
 
Top