Serial question

2 posts in this topic

I have a cell phone modem connected to my Omron CP1L on serial 2

Here is the issue 

I need to pull the phone number out of the msg received (receiving text messages) 

I receive a text msg and a lot of other crap like time and date ect. RDX says store in D100

the problem is that after I receive the SMS I see the phone number and copy the number to D200 to D2xx

The next text comes in and it is added to the length of the previous text and the new phone number is not in the same D area as the first. 
It seems the only time the serial port works is if you declare 20 characters and you get 20 characters Works every time.

But sometimes I may get 12 characters and other times I can get more than 100.

I have used the restart and clear port command with no luck. 
If I set RDX to a large number and receive complete will not come on and the next receive will be added to the first. 
I need a clear buffer for each receive. 
How do I get around this? 
If you set the RDX to 10 but 12 characters were received the 2 extra characters will be in the buffer and added to the next receive. 
I can’t use end receive if x because there is nothing that is always available in the msg. And even if I do any characters received after end code is left in the buffer and screws up the next receive.

I have never seen anything like this.

Any ideas?

Thanks Rob


Share this post

Link to post
Share on other sites

Use the reception counter Auxiliary Address to do your receive.  When the the reception completed flag turns on, use the Reception Counter word to determine how many bytes to receive.  



So, using port 1, it would look like this:



I arbitrarily chose D200 for the reception area.  

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