Michael Doornbos

Modbus CRC-16 for "work"

Been doing a lot of Modbus lately for work, so I wrote my own Python encoder/validator.

So it seemed like a fun idea to try and do Modbus CRC-16 on a Commodore 64.

First proof of concept is with Simon’s BASIC because it has a nice 16 bit unsigned XOR function. After this I’ll do it in Assembly and maybe hook up a Modbus to the USR port and try to bitbang it from the Commodore.

The message is: b’\x11\x03\x00\x6B\x00\x03’ # Slave 0x11, Read Holding Registers

And CRC-16 should be: 0x7687 after swapping to Little Endian (as God intended)

(printing all the loops for debug, and science of course)

https://vimeo.com/1085870752?share=copy#t=0

<< Previous Post

|

Next Post >>