Jump to content
Sign in to follow this  
ORSO2001

Buffer to tag sems doesn't work

Recommended Posts

Dear All,

I am having a strange issue...I try to explain, I am checking the serial communication between a master and a slave (modbus rtu...like a sniffer) and I am using the Unistream to catch the exchanged data...at the beginning, as first test, I record every 10 bytes and save the buffer in a DTI...and all has works fine...now I want to take the exact request/answer between master and slave....then the first record is checking the 8 bytes...the data will be, for example, 1-3-0-216-0-3-134-56 (the CRC is not calculated...I wrote only as example)...then I want check the position 5 in the buffer (3) to know how many bytes will be the answer...in this case will be (3 *2)+2 =11 bytes...I am using the function block buffer to tag to store the buffer[5] and do the calculation...I tried to save the specific buffer position to a single tag and all the buffer in an array...both UINT8 and UINT16 but...but this never works....in the position C of the function block is wrote that if the end tag has not enough space the function will not execute...but I don't think that is the problem...what cna be the cause? What I am wrong?

Share this post


Link to post
Share on other sites

Hi Orso,  have you got a small delay in between the various buffer reads you are doing?  Given that you are working with modbus, you will likely need a few scans at least, if not more, for the buffer to be correct for what you want to do.

cheers, Aus

Share this post


Link to post
Share on other sites

Hi Ausman,

no delay ...what I done is check the amount of incomming bytes and every 8 bytes, that are in the RS485, using an EQUAL block,  pass at an buffer array using the COM RX function...store this last buffer array in a struct that has the same buffer and store in a DTI...increase the row where I store and restart; this works (the communication between master and slave start and stop on my command)...I repeat that if I check, passed, store this every 8 byte all works fine...but I want to split row by row the request and the answer...what is not working is the "store" of a part of buffer in a tag...I have had an idea about the next test that I can do...later I will try and I will update the topic.

 

Share this post


Link to post
Share on other sites

ok..what I were doing was a control of the "expected bytes in input"  in the same row using to function block "equal" and "not equal" then a ramification of the row...if equal i checked the buffer[5] if not equal I did a store as 8 (because 8 byte is alwayse the lenght of the function 0x03)....I splited these in two individual rows...and now works.

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  

×