How to serout a serial qualifier?

MikePembo

New Member
Hi,
How to you serout a qualifier on a PIC08M if you are communicating to another PIC08M using serin.

the serin command is as follows:

Code:
serin 4, T2400, w6, w4
and in the serout command there is no where to specify a qualifier? :confused:

How do you output a qualifier?

Thanks,
Mike
 

SilentScreamer

Senior Member
Serial on pin 0 with the qualifier "ABC" with the following two bytes but into b0 and b1 respectively.

Code:
serout 0, T2400, ("ABC", b0, b1)
 
Last edited:

Andrew Cowan

Senior Member
You just need to send it first - the sending PIC doesn't have to know what is and what isn't a qualifier.

SS's UUU is a preamble to make sure the receiver is ready to receive data. Most applicable with wireless links.

A
 

MikePembo

New Member
Hi,
Thanks for the quick replys!
So,
Will this code work then?
Code:
Serin 4, T2400, w6,w4
and this for sending:
Code:
Serout 0, T2400, w6
Serout 0, T2400,w4
Thanks,
Mike
 

gbrusseau

Senior Member
Put the qualifier in the SERIN command in brackets.

Serin 4, T2400, ("UUU"),w4,w6

Then make sure the UUU is the first data to be transmitted.

Serout 0, T2400, ("UUU",w4,w6)
 

eclectic

Moderator
The best source of information is the Datasheet. :)

From current Manual 2, p. 172

Data are variables/constants (0-255) which provide the data to be output.

So you'll need to output bytes ( 0 – 255), not w0 / w1 .......

Then, read Manual 2, page 169.

Qualifiers are used to specify a ‘marker’ byte or sequence. The command
serin 1,N2400,(“ABC”),b1
requires to receive the string “ABC” before the next byte read is put into byte b1


So, sort the qualifiers from the “preambles” and you should be OK.

Then, from p. 172

Pin specifies the output pin to be used. Baud mode specifies the baud rate and
polarity of the signal. When using simple resistor interface, use N (inverted)
signals. When using a MAX232 type interface use T (true) signals. The protocol is
fixed at N,8,1 (no parity, 8 data bits, 1 stop bit).


And finally, here are two programs that work,
and hopefully show the Byte / Word difference.

Code:
#rem
; transmit
#picaxe 18x
main:
for w0 = 1 to 300
serout 0, n2400, (w0)
pause 100
next
goto main

#endrem

#picaxe 08m
main:

Serin 2, n2400, w0

sertxd (#w0," ")
goto main
e
 

slimplynth

Senior Member
MikePembo doesn't say in his first post that he's using a Max232 interface, is it still possible to use T2400 without the Max232? Ec as put N2400 in his prog for the baudrate, as i would do normally for picaxe-picaxe comms - i didn't think T2400 would work. (i'd try it myself but i can't)

cheers

edit: think im having deja vu
 
Last edited:

moxhamj

New Member
For radio you could use:
Serout 0, T2400, ("UUUUUUABC",w6,w4)
Serin 4, T2400, ("ABC"),w6,w4

The Us are just ignored but they wake up the RF receiver properly.

For direct picaxe to picaxe, you don't need the Us:
Serout 0, T2400, ("ABC",w6,w4)
Serin 4, T2400, ("ABC"),w6,w4
 

hippy

Ex-Staff (retired)
SEROUT and SERIN can only send bytes data. If 'w6' and 'w4' contain values of 255 or less than they can be specified as word variables. If greater than 256 they need to be specified as their component byte variables w6 = b13:b12, w4 = b9:b8.

SERIN and SEROUT to a PC using a direct connection ( no MAX232 ) should use Nxxxx baud rates. With a MAX232 a Txxxx baud rate, and the pin used for SEROUT should be set HIGH ( with a following PAUSE ) prior to the first SEROUT.

When sending a preamble to a RF unit it's recommended, and often required, to place a PAUSE between the pre-amble and sending the qualifiers and data. For a preamble sent with Txxxx baud rates it is not required to set the SEROUT pin HIGH prior to SEROUT.

Transmit:
SerOut txPin, baud, ( "UUUUUUUUUUUUUUUUUUUUUUUU" )
Pause time
SerOut txPin, baud, ( "ABC", b13, b12, b9, b8 )

Receive:
SerIn rxPin, baud, ( "ABC" ), b13, b12, b9, b8
 

MikePembo

New Member
Hi,
Thanks for all the replies,
I need to have the qualifier as a variable that can store 0-65535 (w6)
So will this work for receiving when w6 is a number 0-65535?
Code:
serin 4,N2400,(b13, b12),b9, b8
'             (-QUALIFIER),Variable
and this for sending?
Code:
SerOut 0, N2400, ( b13, b12, b9, b8 )
'                 (-QUALIFIER,DATAOUT)
(It seems to work in simulation)
 
Last edited:

hippy

Ex-Staff (retired)
That will work, but I don't see the logic of using variable qualifiers. If using variable qualifiers I'd probably also include fixed constant qualifiers ...

SerOut 0, N2400, ( "ABC", b13, b12, b9, b8 )

SerIn 4, N2400, ( "ABC", b13, b12 ), b9, b8
 
Top