Copying or combining values from two separate tags into one

threetrey

Member
Join Date
Feb 2020
Location
USA
Posts
18
Hello everyone,
I'm working on something where I am retrieving data from a machine by sending it message packets and using the machine response.
Sometimes the response gets cut off in the middle, so I am having to send the message twice to make sure I always get the full response.

I'm trying to figure out a way to either copy each response into two separate tags and then combine them back into one. With the second response being copied into it immediately at the end of the first one.
Or possibly copy them both into one the same tag from the beginning.


So for example, message #1 comes back into Tag1[0]-[30] and message #2 comes back into Tag2[0]-[20]. I want to combine these into Tag3[0]-[50]. Also the message lengths may change during each response as well.

Anybody have any ideas on how to do something like this?
Also I'm using Studio 5000 for this.

Thanks
 
Last edited:
Is this two Compactlogix/Controllogix machine talking to each other? Get rid of the messaging and use produced-consumed tags. The tags can include status elements that are helpful for this type of debugging.
 
No this is a very old machine, having to communicate with it through a prosoft module by sending it ASCII messages
 
Without fully understanding your ASCII messaging scheme, is there a message done bit or something similar that you can monitor? With the done bit you can:
a.) Buffer the read data when bit is on. This way you can confirm you got ALL the data.
b.) Retry the message when message has been executed but bit is still off after a time delay.
 
Last edited:
There's not much I can do with the ASCII message to control what I get back everytime.


I'll try to explain better.
So I am having to send the message to the machine twice. Sometimes in the 1st response I get the full message back. Sometimes I get a partial response back, and the rest of it comes in with the second message. And then sometimes I'll get nothing back on the 1st message, but I get the full response on the second. So all of the responses will be variable lengths.
The data comes back into my CLX into a tag that can hold up to 256 SINTs. A full message will use approximately 120 SINTs.


So I am copying response #1 into DataTag1[0]-[X]
Response #2 goes into DataTag2[0]-[Y]


I want to combine them into 1 single tag: DataTag3[0]-[X] with [0]-[Y] copied in immediately following X.
 
Doesnt the send and receive functions handle the data consistency natively ?

(I dont know CLX, but any proper messaging function should handle this and for example only set a "done" bit when all data has been transferred).
 
I too do not know CLX messaging but a couple of things come to mind, does each message have a control char at the end of message, you could check for this, On receive can you give it a small time delay before reading the data.
I once had this where an ascii message could have varying lengths and no end char, to ensure the longest message was received we introduced a delay long enough for the longest message to be populated into the receive buffer as reading it on notification of data in the buffer could cause only part of the message to be populated, it means increasing the coms time a little but this was only ms.
 
Yes I can adjust the time delay before it reads the data, I've tried playing with that a good bit but it has not seemed to make any difference. I've tried changing it anywhere between 50ms up to 1 second and I still see the same issue.
Also, the second message I am sending, I am actually sending it to an address that does not exist, not double messaging the same machine. So this way, I'm able to get the remaining part of the original response to come back with that "fake" message without having any new data interfering with it.
 
Your receiver message should contain both leading and trailing characters
they define the message if both are not receiver in a message then the complete message should be rejected because you don't really know what part you are missing
use the ASCII functions to strip out the string you want
 

Similar Topics

I'm not super familiar with the Micrologix line of processors, but I am pretty familiar with RSLogix 500. I'm trying to simply copy a string to...
Replies
4
Views
305
Hi All, I am looking to copy and paste a routine. I know this has to be done offline. My question is, when I go back online, these tags are...
Replies
6
Views
554
Hello everyone, friends. I need help with something related to SCL. In a FB, I need to copy the value in the DB to the DB at another address. I...
Replies
3
Views
1,385
Hello all! Is it possible to COP a SINT array to a UDT structured the same as a SINT array, except all BOOL bits? I have a module that has an...
Replies
5
Views
3,172
Hello, looking for a way to capture and display the accumulated time for a retentive timer in rslogix 500 on a microligix 1400 plc example move...
Replies
3
Views
1,650
Back
Top Bottom