MisterB.Ohio Posted March 24, 2020 Report Share Posted March 24, 2020 I am trying to receive data from an instrument. The data stream is a series of binary numbers. The help file for the Protocol FB says that it can receive a variable as a binary number. However, in practice this does not seem to be the case. Can a V700 PLC receive a binary number and save it into an MI ? again using the protocol scan function I do not see how this is possible. Thanks for any help with this. Bill Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted March 25, 2020 MVP 2023 Report Share Posted March 25, 2020 Receive the data HOW? cheers, Aus Link to comment Share on other sites More sharing options...
MisterB.Ohio Posted March 25, 2020 Author Report Share Posted March 25, 2020 Ausman, as the topic says, the instrument is connected through an RS232 cable to the PLC. I have the port2 of the V700 initialized and it is configured. Using the protocol scan to receive data, you can receive all types of ASCII data. My question is how can you receive binary data. IE when the instrument (an axetris TDL) sends a stream of bits (or hex) how can the value of those be saved into an MI? the data stream for a valid response contains 16 bytes from the instrument. an example is: 7B 4D 10 00 00 00 28 54 EE 45 00 00 00 00 79 7D The first 2 bytes are "{M" meaning a measurement value response. The next 2 bytes are the total number of bytes transmitted, in this case 16. The next two bytes are an error code. in this case 0 meaning no error. The next 4 bytes are the actual data. It is sent as an IEEE 754 floating point number. I can convert that but need to be able to store the 4 bytes as 2-16 bit integers. in this case 10324, and 60997. The next 4 bytes are filler to make the package a multiple of 8 bytes long. The next byte (79) is a 2's compliment check sum. The final byte (7D) is the end of packet, "}". Maybe the way to read this is not using the PROTOCOL SCAN function block. If not how should I do this? Also the instrument sends various responses, varying in length and information that is sent. However if I can read this one I should be able to adapt to read the others. Thank you for any help or suggestions offered. Bill Link to comment Share on other sites More sharing options...
MVP 2023 kratmel Posted March 25, 2020 MVP 2023 Report Share Posted March 25, 2020 I used this little samle for read non standard protocol from power supply. Message with different length easly read in to MI vector. PROT_FB.vlp Link to comment Share on other sites More sharing options...
MisterB.Ohio Posted March 25, 2020 Author Report Share Posted March 25, 2020 Figured out how to receive the values. I have to save each of the values as a 4 byte string of fixed length. I just need to define each of the possible replies from the instrument and I'll be done. HOWEVER, the check sum had to be added as a variable. I'll have to still figure that out. The instrument calculates it by adding the values of each byte sent, taking the LSB and sending the 2's compliment of this. It does not add in the checksum itself or the closing '}'. DO I need to set the "offset till (backwards)"? Link to comment Share on other sites More sharing options...
MVP 2023 kratmel Posted March 25, 2020 MVP 2023 Report Share Posted March 25, 2020 I think that to communicate with the instrument you do not need to worry about the checksum when receiving messages.The key is to make sure that the entire message is received (checksum as a number and also {} as characters) and that each part of it is correctly written to a variable.You will be able to transmit all the values you need and then you can start experimenting with a checksum to ensure a guaranteed transmission. Link to comment Share on other sites More sharing options...
pdovidal Posted April 9, 2020 Report Share Posted April 9, 2020 On 3/25/2020 at 1:53 PM, kratmel said: I used this little samle for read non standard protocol from power supply. Message with different length easly read in to MI vector. PROT_FB.vlp 255.9 kB · 5 downloads Hi, i´m having issues reading from a barcode reader Honeywell MS5145 on RS232. First i modified the visilogic example for communicating with hyperterminal but without any success. Than i made some mods on your sample and i could receive messages from Docklight V2.3 (that is free insteed of hyperterminal), configured to be the same message size and config as from the barcode reader. Atached is the modified sample code and the docklight screenshot The text on blue is what i sent to the Samba SM35, the text on red is what barcode reader sends to the SM35 but without success. Same 7 char message with <CR><LF> as ETX. But the Protocol scan FB just completes sessions from docklight, nothing from the barcode reader. PROT_FB_test.vlp Link to comment Share on other sites More sharing options...
MVP 2023 kratmel Posted April 9, 2020 MVP 2023 Report Share Posted April 9, 2020 This is my simple protocol configuration for zebra motorola LS2208 barcode scanner. You can use numbers placed in vector copy MI150 (in my sample), if you scan another barcode it will be replaced (MI50 to MI150 copy vector) P.S. But maybe moderator can place this part of topic separately. Link to comment Share on other sites More sharing options...
pdovidal Posted April 9, 2020 Report Share Posted April 9, 2020 2 hours ago, kratmel said: This is my simple protocol configuration for zebra motorola LS2208 barcode scanner. You can use numbers placed in vector copy MI150 (in my sample), if you scan another barcode it will be replaced (MI50 to MI150 copy vector) P.S. But maybe moderator can place this part of topic separately. thank you, i will move it to another topic Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted April 10, 2020 MVP 2023 Report Share Posted April 10, 2020 Once a thread starts we can't separate the replies into a fresh thread. That would be a nice feature. Joe T. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now