Jump to content

Recommended Posts

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

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

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

  • MVP 2023

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

  • 2 weeks later...
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.

 

 

2020-04-09 092537.png

PROT_FB_test.vlp

Link to comment
Share on other sites

  • MVP 2023

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)   

barcode_simple.JPG.3b1a8e1ccefe927c0e08c07f98905d00.JPG

 

P.S. But maybe moderator can place this part of topic separately.

 

Link to comment
Share on other sites

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)   

barcode_simple.JPG.3b1a8e1ccefe927c0e08c07f98905d00.JPG

 

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...