Mosteck

CX-Protocol - CJ2H RS422 Communications Setup Questions

2 posts in this topic

I'm working on a project that requires me to talk to another unit through RS422 bidirectionally..  The communications are nothing really complex, but I have a few questions for starters.

1. The data that it expects to see is ">IIIDDDCC<"

Where:
>=header
III=3 byte command numerical ID (this is unique based on what information you want to send or receive)
DDD = Data (is variable length depending on what we're sending)
CC = 2 byte checksum
<=terminator

My first question is the checksum.  They base this off of the ID and data based on an ASCII value of 0=30, 1=31, 2=32.... 7=37 and do a calculation based on that.

For example, a simple one of >00090<, the 90 is calculated by 0x30+0x30+0x30 = 0x90.  More complicated would be >107000058< where 58 is calculated by 0x31+0x30+0x37+0x30+0x30+0x30+0x30 = 0x158 and take the 2 least significant digits to be 58.

In CX-Protocol, they have a few different check codes (LRC, LRC2, CTC-CCITT, CRC-16, etc,), but I can't find a good explanation of each one to see if either would work.  Does anyone have a suggestions on this?

2. When creating a sequence in CX-Protocol, I'm thinking mine would be pretty straight forward.  I've never really done it before, but I'm thinking something as simple as:

Step 00 - Flush
Step 01 - Send & Recieve with the send message being the >00090< and the receive message with a memory location to move the data (haven't got to that point yet).

Is this really all I would need?

Thanks for your assistance.

Edited by Mosteck
Spelling mistakes

Share this post


Link to post
Share on other sites

Checksum descriptions can be found in section 3-4-8 of the manual included with the software.

56c79fac16a20_Protmanuallocation.jpg.6ea

Question 2: You likely will not need the flush.  Send and receive will do the trick.  The data conversion (read and write syntax in CX-Protocol) can be a bit tricky though.

 

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