News » libmodbus

libmodbus discovery 31/1/08

Update! - Just found a far newer, more comprehensive libmodbus at another site, which might save me from a lot of pain in the 'C' area... (I really suck at C programming). The newer libmodbus is here.

Some spectacular progress was had over the last couple of nights tinkering...

I've now layer 1&2 working, the PIC will buffer a frame, check the CRC, and reject frames based on framing, parity or overrun errors. At the PC end I've got some C code that can send a valid command with CRC attached, and get back a return and process it.

With that out of the way I've started writing some routines at the PC end to give me high level commands for controlling the slave RTU(s). I had a look at libmodbus which provides a lower level interface than I imagined, and will not compile cleanly on my test machine for some weird reason.

I've got the PIC interpreting the address and Function fields of a single command, and returning an 'illegal function' error to the PC, which in real terms means I've got all the difficult bits working, now I've go some hard-slog writing all the functions.

To that end I've created a Software page under docs which lists the functions I've done or not, and where things are at with that part of the process.

A discovery has been made though, and that is that my 'C' skill are very rusty, I've had some difficulty with some basics of pointers and implicit function prototypes which I know I understood a few years ago. Must be getting old. I've also got an annoying bug in my current testing code where the program can only send and receive one frame, then all subsequent frames in the same session fail.

Powered by Etomite CMS.