3 posts in this topic

Sorry its long !!

I am recieving text from a GSM modem for text msg Send and receive (SMS)

works ok but would be better if I could make use of the start code and end code.

This way I could cut down on all the crap that is received when a text arrives.

I get this 

CMTI: "SM",0

I have it stored into D80 and I have that trigger a TXD that sends

AT+CMGRD=0 and that tells the GSM to send the msg (The 0 is the current msg in memory)

------ The problem is that there is Carriage  Return and Line Feeds in the received msg ----      AS below

((AT+CMGRD=0
+CMGRD: "REC UNREAD","+19028991212","","22/10/20,16:57:54-16"
 Hello this is the msg 

OK))

When the PLC sees the carriage return it stops receiving data. And I have no start code or end code setup. (I am using characters received)

The way around this is to set a high  character count in the RXD (More than the actual msg (More than the msg length)  

The main issue with that is I get garbage in as the msg gets bigger. Its unreliable.

I clear the port after each receive and that helps but still get the odd garbage. (Never get garbage when connected to a terminal prg).

Any Ideas????

ps

Even the Start Code is unreliable as it will start receiving a few characters late.

Rob

 

Share this post


Link to post
Share on other sites

I would try Start code (( (0x2828) and End code )) (0x2929).

1 person likes this

Share this post


Link to post
Share on other sites

Sergei makes a good suggestion.  I might also set CR+LF as the end code and receive each part of the message separately (5 total messages, if I understand correctly).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now