Serin and Serout Timings

hal8000

Member
For all M2 picaxes e.g. 18M2 if I dont use the setfreq command
the picaxe will run at 4MHz


What is the difference between these commands,
if used with a picaxe running at 4MHz:

serin B.0,N2400,b0

and

serin B.0,N2400_16,b0


2400 is still 2400 baud but will the frequency suffix
( e.g. _16 in the above command) alter the data?

I've had a look at manual 2, page 204, but cannot find
information about the speed.
Should N2400_16 only be used with setfreq m8?
Thanks in advance.
 

KeithRB

Senior Member
N2400 and N2400_16 are just constants setting the proper baud rate at a particular frequency. Since they are constants, then yes, they will cause incorrect baud rates when used with the wrong frequency.
 

hippy

Ex-Staff (retired)
Should N2400_16 only be used with setfreq m8?
It should only be used with SETFREQ M16 as should any other baud rates with a _16 suffix.

As noted, you can use anything, but the baud rate might not be what you expect or want.

On all PICAXE you can specify a baud rate without a suffix and that defaults to the suffix of the default speed for the particular PICAXE. For example 2400 is the same as 2400_4 on M2's and same as 2400_8 on X2's.

My own recommendation is; use the baud rate without a suffix if not using SETFREQ and use baud rates with suffixes when you do use SETFREQ. That makes it easier to move code from one PICAXE to another without finding odd things happening. It's also easier to tell what the code is doing and to spot errors when you or others have to debug the code.
 
Top