Jump to content

Recommended Posts

I am currently trying to receive a Hex as ASCII message from an instrument over RS232 on a V700. Currently to simulate I have been sending the expected messages over serial, but in the future the data will be constantly streaming. The Index of Received from the Scan Protocol keeps giving me a -1, indicating an invalid message and I can't seem to understand why. Anything should help at this point. 

The measurement packet contains 24 bytes, 2 bytes for the beginning, 1 byte for the checksum, and 1 byte for the end of packet, as indicated by the instrument and reflected in the Scan Protocol.

232Test.vlp

Link to comment
Share on other sites

So I now know that the checksum is calculated correctly, however I still am unable to receive/store the message as I expect. It feels as if buffer is just constantly being reset instead of storing the message being received. How can I move forward?

Here is an example of the type of message I am expecting to be receiving:

7B 4D 18 00 05 71 47 42 03 BC 4D 46 E0 AB F4 41 00 00 00 00 0F 7D

I have been sending this to COM 2 to no avail.

232Test.vlp

Link to comment
Share on other sites

  • MVP 2023

Kratmel has just replied whilst I'm writing this!

I've had a quick look at the program and one glaring error is rung 2 where you have MB2 shown as a coil, it should be an inverted contact .  There are other things that are a waste of space with what is shown.  MB1 is not really necessary the way you have things running.  I get the impression that PLC logic is new to you and perhaps a bit of research into how the different elements work would not go astray.  The help files will cover all of this learning curve.

The other thing to remember is that even though the system may say that serial actions are finished, I always allow at least a few scans for the buffer to fully clear.   You may run into issues if you don't do this.  A simple counter loop incrementing on each scan that runs after the system says it is finished is the easy way to set this up, where it resets to 0 once reaching the number that consistently supplies good serial operations. The 0 reset is also the trigger to do another serial action.

Anyway, have a look at Kratmel's efforts.

cheers, Aus

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...