How to talk to a serial device with certain requirements

Hi there

i want to create a ardunio device that communications to a Serial Device. It would send a command and then wait for a reply and send another, etc.

But the serial Device uses a certain type of class to encode the command before sending. It uses a CRC16. which i use in my C# program in Visual studio. i have attached it.

i’m not very good with the arduino but still learning.

How would i go about doing this?

Thanks

regards
jeremy

crc16.txt (2.38 KB)

i have attached it.

It seems not to be attached

the serial Device uses a certain type of class to encode the command before sending. It uses a CRC16

Does it actually encode the data or just send a CRC value with it ?

you should see it now. when i first posted it. the site wouldn't let me attach the file.

to send a command i just send this to the serial port Crc16.GetCommand("QOPM")

Depending how the port is set up the device replies in hex. and then do a Encoding.ASCII.GetString()

if you would like to see what i use in my C# project i can show you my data send and receive.

I don't know why but this site keeps coming up with "
You have exceeded the number of posts you can make in a 5 minutes period. Please try again later." start to get very annoying.

You have exceeded the number of posts you can make in a 5 minutes period. Please try again later.

The 5 minutes between messages for low count posters is an anti spam measure. The forum software does that when you only have a few previous posts and it will stop doing it after the trigger level has been reached.

There are CRC16 libraries for the Arduino such as GitHub - vinmenn/Crc16: A simple crc-16 library for Arduino but I have no experience of them.

A search for CRC16 in the forum could also be useful