ORSO2001 Posted December 12, 2018 Report Share Posted December 12, 2018 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? Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted December 12, 2018 MVP 2022 Report Share Posted December 12, 2018 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 Quote Link to comment Share on other sites More sharing options...
ORSO2001 Posted December 12, 2018 Author Report Share Posted December 12, 2018 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. Quote Link to comment Share on other sites More sharing options...
ORSO2001 Posted December 12, 2018 Author Report Share Posted December 12, 2018 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.