Serial port problem

zs6wbt

New Member
Please help i try to get the PICAXE 29X1 on my AXE020 development kit communicate withe my PC the examples in the manila (picaxe_manual3) do not work this is the command that i send to the CPU

serout 7,N2400,("Hello")

I use the USB programming cable to do all the communications withe.
 

nick12ab

Senior Member
In addition to posting in the wrong part of the forum, you haven't specified the correct pin for sending serial data to the computer. You have chosen B.7 but the required pin is A.4.

An alternative method is to use the sertxd command instead.
 

zs6wbt

New Member
Thanks for Replying
Goeytex The [ setxd ("Hello") ] work but it limits me to 4800 board tar on the 28x1

nick12ab I must say i struggle withe that one, to use "A.4" insted of "7" on the 28x1 the compiler gives me a error and do not want to compile. I noted that i have placed this on the wrong place on the forum where shold it be? it seems if it was removed or moved to a place where i do not get it.
 

Goeytex

Senior Member
"Goeytex The [ setxd ("Hello") ] work but it limits me to 4800 board tar on the 28x1."

Then you need to increase the frequency of the chip by using "setfreq M8" or "setfreq EM16".
8Mhz will make sertxd 9600. 16Mhz will make sertxd 19200.

For faster Serial, you can use hserestup/hserout.

You should take time time and read the manuals.
 

nick12ab

Senior Member
nick12ab I must say i struggle withe that one, to use "A.4" insted of "7" on the 28x1 the compiler gives me a error and do not want to compile. I noted that i have placed this on the wrong place on the forum where shold it be? it seems if it was removed or moved to a place where i do not get it.
A.4 is only available on newer chips such as the PICAXE-28X2 and not the PICAXE-28X1.

I suggested it because I didn't know what you were actually using when you said "PICAXE-29X1" although in retrospect you were more likely to be using a PICAXE-28X1 instead of a 28X2, however if you're buying new PICAXE chips you might as well buy a 28X2 since it's so much better for almost no extra cost.

On the PICAXE-28X1, the Serial Out pin cannot be controlled using the serout command and you must use the sertxd command. You can use the setfreq command to change the clock frequency which will change the baud rate.
 

zs6wbt

New Member
nick12ab Thanks for hellping me.
Im going to order a X2 from PICAXE i was cheeted into the X1 by a hoby-electronics shop in Johannesdurg SA that soled the X1 to me and told me it is a X2 so. I try to make the best of the situation but I will have to get the X2. Any way you have helped me to think differant and I got the RS232 out on the B.7/pin 14 on the chip like you sead and i can use it from there the only trick I figerd out is that I must use it straght from the pin before it go throu the ULN on the AXE020 development board.
I assume if i use the "serin 1 N2400" command it will actualy read in from pin A.1/ pin 3 on the chip or will this be C.1 /pin 12 on the chip?
My end target is to read the serial input from a GPS and send it to a OLED disply and a PC
 

nick12ab

Senior Member
I assume if i use the "serin 1 N2400" command it will actualy read in from pin A.1/ pin 3 on the chip or will this be C.1 /pin 12 on the chip?
My end target is to read the serial input from a GPS and send it to a OLED disply and a PC
Yes it will be C.1 / leg 12. The term leg is used to refer to a physical pin on the IC so that it doesn't get confused with input/output pin numbers (0-7).

For X1 parts, the pin is simply called input 1 - C.1 is the name for X2 parts. If you use a number (0-7) with an input command such as serin, the PICAXE automatically knows to use inputs 0-7 (pins C.0-C.7 on X2, legs 11-18) and if you use a number with an output command like serout, an output pin (legs 21-28) will be used instead. See here for information on the limited flexibility of the input pins (portC) on the PICAXE-28X1.
 

zs6wbt

New Member
Thanks Nick
Now the things start to foll in place and start to make more sens to me I have a new Question How do the Timeout on the serin command work I get a compiler error when i enter the following:
serin 10,0,N2400,b1

The error is:
serin 10,0,N2400,b1
^

Error: Syntax error in this line!
 

zs6wbt

New Member
Thanks Nick that was a stumped fault on my side.

I have learned a lot from and i relay appreciate your help

I hope this will be my last Question on Serial communication for the 28x1. I still do not read serial data into b1 at leg 18 of the 28X1 withe this command (serin [4000],7,N4800,b1) see the total code below.

Have a nice day
Willie

'###################################################################################################################

#picaxe 28X1

main:

b1="X" 'Put X in b1 just to have a char in it

'My OLED disply is reprogramd t work on 2400 burd and is conected to the PICAZE 28X1 in leg 21 to TX data
'This part Clearsthe first line of the OLED and say Hello to indicate that the disply receve data
serout 0,N2400,(254,128)
serout 0,N2400,(" ") '
serout 0,N2400,(254,128)
pause 1000
serout 0,N2400,(" Hello ")
pause 1000
serout 0,N2400,(254,128)
serout 0,N2400,(" ")

'This goto the read in RS232 from (GPS)
' (at thie moment it is to read one Char from the PC terminal program at 4800 burd
gosub Lees

pause 1000

goto main

Lees:
'Send amesage to the OLED
serout 0,N2400,(254,128)
serout 0,N2400,("Wating for input")
'Send a mesage to the Terminal / PC
sertxd (10,13)
sertxd ("Wating for input")
'Waght for input from PC on leg18of the PICAXE 28X1
serin [4000],7,N4800,b1'----------------------------------------MY PROBLEM it never read anything in to b1

'Send the deceved Char to the OLED
serout 0,N2400,(254,128)
serout 0,N2400,(" ")
serout 0,N2400,(254,128)
serout 0,N2400,("Input= ",b1)
'Send the deceved Char to the PC/ Terminal Program
sertxd (10,13)
sertxd (" Input= ",b1)
sertxd (10,13)
return
'################################################################################################################
 

zs6wbt

New Member
The PC/ terminal cable TX is connected to leg 18 of the 28X1 and the RX is connected to the normal programming leg 7 - Sorry i forgot to esplan the cable conection
 

zs6wbt

New Member
OK if any one ever see this i have solved the problem after a lot of frustration - the command mist be
serin [4000],7,N4800_4,b1'

I had a mis understending of the meaning of the "_4" end therefor i levt it out

I hope theis mighy help ather newcommers that read this posting
 
Top