ASCII variables

MPep

Senior Member
This might sound rather daft but here goes: How do I send an ASCII variable using SEROUT or SERTXD?

Before anybody mentions it, yes I kow how to send as part of a set string, ie:
Code:
 SERTXD ("Hello World",13,10)
However what I want to do is to check what is coming in, ie:
Code:
RMCIn:
serin DatIn,Baud,("RMC,"),b0,b1,b2,b3,b4,b5,b6,b7'
 
sertxd (#b7)  '<----------------------- I am having trouble trying to send out the ASCII character stored in B7
if b7 != "V" then Main   ' Check if data is Valid
I know that B7 is either "A" or "V".
Or is this a simulator issue, as I am currently using this to test. Haven't built hardware yet.

Any ideas?
Thanks all,
MPep.
 

russbow

Senior Member
I think the ascii values for the alphabet start at decimal 65 ($41)for A and go sequentially through to dec 122 ($7A) for lower case z. This follows that you can use CR,LF in sertxd or 13,10. The LCD / CLOCK pdf lists these at the back

Russ.
 

hippy

Technical Support
Staff member
Not sure if I understand the question ( is it the already identified issue of having a comma in the qualifier ? ), but this works ...

#Picaxe 08M
Serin 1, N2400,("ABC"),b0
SerTxd( b0 )

When it prompts for input enter ...

"ABC","w"

The "w" will then be stored in b0, then emitted to the Simulator Serial Panel.
 

MPep

Senior Member
Hi Hippy,

It is almost the same.
Just tried again, by entering "1234567V",13,10 which works.

It appears as though the simulator does not recognise commas no matter where they are.

In an actual $GPRMC sentence, the structure is "$GPRMC,123456,V,....".
I tried emulating this, but it appears to get hung up on the comma.

Something else (well really the same thing) to work on.

Got it sorted for now.

As to the previous problem, I currently do not bother checking for a qualifier, just go straight into entering the desired numbers.


Thanks
 

MPep

Senior Member
Hi WA,

I am aware of your table. And thanks for reminding others who may read this post.
It was really a matter of myself being able to read what was received.
It turns out that there is a deficiency in the Simulator, in that when entering an ASCII string, it does NOT recognise Commas.


@Hippy,
In fact, come to think about it, it turns out that the Comma is skipped over. The resultant, when I enter ["123456,V",13,10], is actually 13 or 0D!

Hope this helps you sorting out where the problem lies.
 
Top