serin/serout problems with newer (X1, X2) picaxe chips

JanJor

Member
Dear forum, I never experienced communication problems (serin/serout) between two 18X chips or between an 8M and an 18X chip, but then I bought a 20X2 that did not communicate with the "old" chips. I blamed the calibfreq factor and forgot about the problem (all te other functions of the 20X2 work OK).
However, I now tried to establish serin-serout communication between an 28X and an 28X1 and also between an 28X and an 28X2, but again without any success.
These are the extremely simple test programs:

setfreq m4
test1:
for b0=1 to 100
serout 1, n1200, (b0)
pause 100
next
goto test

and

setfreq m4
test1:
serin 1, n1200, b0
sertxd (#b0,13,10)
goto test

And as said, these programs work flawless with the "old" Picaxes.
The new chips are OK, the in/out pens are OK, connection is OK (through 330 ohm resistor) but what I see is not OK: the receiving chip do receives something every 100 msec, but what it receives is rubbish. From 28X1 to 28X, it is the same strange sequence of numbers 6, 24,30,96,102 etcetera, and from 28X to 28X1 it is really rubbish. Replacing the chips by others does not change the picture, changing the baud rate to 2400 or 600 of from N to T does not help either, so actually, I've tried every variable but nothing helps. I'm almost certain that it is a baud rate problem related to the "newer" chips such as the 20X2, 28X1, 28X2 and the like. BUT: how do I solve it? I honestly checked the whole forum for posts relating to this problem, but I don't find a solution there. I know there exists a HSERSETUP command, but that does not work on th "old" chips and I only expect more problems when mixing HSERIN/HSEROUT and SERIN/SEROUT combinations. Any ideas anyone? Thanks very much in advance.
Ronald
 

nick12ab

Senior Member
For X2 parts at 4MHz you must specify _4 after the baud rate (N1200_4) as the default speed is 8MHz so N1200 is the same as N1200_8.

Also have you got decoupling capacitors fitted?
 

Technical

Technical Support
Staff member
As Nick says X2 parts runs at 8MHz , so if you change the default speed to 4MHz you must change the baud rate as well.
If in doubt use the _4 and _8 suffix on all of the parts for clarity.
 

Goeytex

Senior Member
Hi Ronald,

Be sure you have the Latest Version of Programming Editor. Read manual 2 page 208 for the correct syntax for serout. It is a good idea to get into the habit of using baud rate in the form of N2400_x where x is the Picaxe clock speed.

Your code should therefore read:
Code:
setfreq m4
test1:
for b0=1 to 100
serout 1, n2400_4, (b0)
pause 100
next
goto test

and

setfreq m4
test1:
serin 1, n2400_4
sertxd (#b0,13,10)
goto test
 

JanJor

Member
Dear Nick12AB, Technical and Goeytex, I apologise for the late response, but thanks to your help the problem is solved!
The picaxes communicate flawles.
Thanks again,
Ronald
 
Top