Serial Communication with 18X

jledger

New Member
I'm attempting to create an application which will allow the PICAXE to communicate in/out of the same PC that was used to program it. (IE: the same serial port) On the 08M it wasn't as much as a hassle because OUT 0 and Serial Out are the same pin.

Can someone set me straight here? Also, are there examples of how to handle text input somewhere?

thanks
Jeff
 

jledger

New Member
Continued reading/searching the forum this even revealed the limitation of the "Serial" lines regarding this project, so I've adapted.

I'm am curious however, how to handle entire lines of characters instead of only one...

loop:
serout 4,N600,("Login: ")

serin 1,n600,b1
if b1="1" then hiddenitem1

serout 4,N600,("Hello, ",b1,10,13)
serout 4,N600,("Try again..",10,13)
goto loop
 

womai

Senior Member
To print more than one line, you can use the predefined constants "cr" (carriage return) and "lf" (line feed), i.e.

serout 4,N600,("First line.",cr,lf, "Second line.")

TO save output pins and simplify your design, you can use the sertxd command that sends data up trough the download cable.

Wolfgang
 

whizzer

Senior Member
As a matter of interest, the codes that oldbitcollector used (13 and 10) ARE the codes for ‘carriage return’ and ‘linefeed’. It’s just that he had them in reversed sequence in his program. It seems that many, (but not all) serial terminals are sensitive to the sequence that these two codes are received in.

So, even this code won’t do what is expected..
SEROUT 4,N600,("First line.",LF,CR, "Second line.")

While of course these forms of code DO work as expected..
SEROUT 4,N600,("First line.",CR,LF, "Second line.")
SEROUT 4,N600,("First line.",13,10, "Second line.")

Anyway, using the predefined constants as womai suggested is a surefire method of remembering the correct sequence! :)

Edited by - whizzer on 18/05/2006 07:16:21
 
Top