Sign in to follow this  
Followers 0
sarahclark

RXD Help

14 posts in this topic

Hi all, I'm using a CJ1G with a Maestro 100 GSM modem for call out txting. The modem's connected to the CPU RS232 port. When the modem recieves a txt, it sends e.g.: \r\n+CMTI:"SM",8\r\n To recieve this, I have to use 2 RXD's to get the string. The problem is: the 2nd RXD (to get the +CMTI:"SM",8) , dosn't always get the full string. I lose up to 4 words from the start of the string. I put the baud rate down to 4800, but I still lose 1-3 bytes. Very annoying. Anyone have some ideas on why this is happening? Thanks, Sarah

Share this post


Link to post
Share on other sites
What are you using for the 3rd operand of the RXD instruction?

Share this post


Link to post
Share on other sites
Hi, Using A393, the Reception counter. I'm using this because I get a variable amount of data, but always with the end code of 0D0A. I believe the reason why I am losing data is because I am trying to use the RXD instruction several times within the same rung. Reason why I am doining this is because the modem sends (at once) e.g \r\n+CMGR:\s"REC\sREAD","+64274784120",,"05/05/18,14:20:02+48"\r\nHello\r\n\r\nOK\r\n I need to store the SMS details and the message in different locations, so i use 2 RXD's for this. 1st RXD (for details) loses some bytes. 2nd RXD (for message) is always fine. Slowly working thru this, but any ideas appreciated. Thanks, SarahC

Share this post


Link to post
Share on other sites
I would use one RXD instruction and use XFER or MID$ to cut up the response after reception.

Share this post


Link to post
Share on other sites
I found that if i used one RXD instruction, data was overwritten. e.g. wanted this: +CMGR: "REC UNREAD","+64274784120",,"05/05/20,14:21:29+48" and got this: test messageUNREAD","+64274784120",,"05/05/20,14:21:29+48"

Share this post


Link to post
Share on other sites
If that is the case, then there has got to be a stray CRLF occuring in your string. I suggest you use a data tap utility to actually monitor the data stream. Here's a good one: CommTap V2.11 @ MrPLC.com

Share this post


Link to post
Share on other sites
Much easier to use an SCB and CX-Protocol quite frankly. May cost a little more in hardware but a lot less time and frustration.

Share this post


Link to post
Share on other sites
1) Not a chance of getting CX-Protocol to play with. Definite NO from boss 2) I have been monitoring the data. As posted above, the modem sends (at once) \r\n+CMGR:\s"REC\sREAD","+64274784120",,"05/05/18,14:20:02+48"\r\nHello\r\n\r\nOK\r\n I use 3 RXD's. The first to get the: \r\n+CMGR:\s"REC\sREAD","+64274784120",,"05/05/18,14:20:02+48"\r\n The second gets: Hello\r\n The third gets: \r\nOK\r\n The second and third RXD are OK, I get all the data. The first RXD gets rid of the initial \r\n and then stores the SMS details. My problem is that I lose some of the first bytes of the details. For now, it's not too much of a problem, but I wait to see what happens when I ramp the baud rate back up.

Share this post


Link to post
Share on other sites
and also no SCU. Customer "why buy more hardware when there's a perfectly good serial port on the CPU? Make it work"

Share this post


Link to post
Share on other sites
Absolutely, stupidly short sighted!!!! How much is it costing in time and frustration????? Edited by BobB

Share this post


Link to post
Share on other sites
...sigh.... You speak to the converted. But not everybody has the same view.

Share this post


Link to post
Share on other sites
I still fail to see why you can't bring the whole string in at once and then cut it up into the three pieces of data in ladder. Please post the rung with the RXD instruction. Also take a screenshot of the PLC Settings screen that shows the setup on the RS232 port. Also what's going on on the RTS/CTS lines?

Share this post


Link to post
Share on other sites
Here's the comm port settings and the data that I recieve from modem through RXD's. D4500 is from the first RXD. In this case, it is mising 2 bytes. D4530 is from the second RXD. It has complete data D4470 was from a RXD earlier in the program, it is also missing 2 bytes I'm not sure how to post the rung, bear with me. As the baud rate is increased, more data is lost, including parts of the phone number the reply SMS was recieved from.

Share this post


Link to post
Share on other sites
....and the rung... AlarmReply.cxr

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
Sign in to follow this  
Followers 0