TL;DR: Potted solutions are at the end.

On 11.09.17 11:44, Marius Liebenberg wrote:
> Hi
> I need to write a custom RS-422 protocol to control a plasma cutter. I have
> a mesa 7i44 (amongst other's ) on the system.
> I have never used or seen any examples of how to communicate to custom
> hardware vie the RS-422 on the mesa cards. Is there anyone out there that
> has some examples that I can look at to get started please?
> Or some advise will do as well thanks.

There will be some simple serial packet protocol or other out there in
the googleverse, but the fundamentals are:

+  It's a serial packet protocol, and whether it's RS485,RS422, or RS232
   on the physical layer doesn't amount to a hill of beans, except that
   RS422 tells us that it's point-to-point, so destination addresses
   aren't really needed.

+  Writing packet assembly code is simple - it's stacking bytes in a
   buffer. The packet parser at the receiving end is a little bit more
   work, which you might like to re-use on a subsequent project - so
   maybe add source and destination address bytes to the packet, even if
   you just dump them on receipt, at this stage.

+  So a simple packet would look something like this sequence of bytes:
   A recognisable header byte, i.e. a constant, e.g. 0x47 = 'G' ;-)
   Destination address. 0 - 255
   Source address. 0 - 255
   Length         If this is included, you have the option of variable
                  length packets. The count need only cover the variable
                  payload.
   Payload bytes.
   ...
   How many do you need to tell a plasma cutter how to dance?
   CRC or simple checksum byte.

The packet parser is a state machine which ignores anything received
until a header is seen, then advances statewise as packet bytes are
parsed. It's a really good idea to checksum each received packet, and
request a resend if it is corrupted. That's Transport Layer logic.

Packet queues at Tx and Rx ends are needed, unless backward ACK/NACK is
used to stop Tx if Rx isn't ready. If the plasma cutter can do only one
thing at the time, that might do for starters.

DIY can be weeks of work before it's reasonably capable and reliable, so
let's now run "AVR embedded packet protocol" up the flagpole. Ah, the
second hit is: https://en.wikipedia.org/wiki/Cubesat_Space_Protocol
and it's good to go on 8 bit AVR and 32 bit ARM chips (whoops, is that
my bias showing? That's what I'd put on the Rx end.)

It's written in 'C', so nicely portable, and runs in a number of POSIX
environments, including FreeRTOS and Linux. So it's compatible with a
LinuxCNC host and an embedded slave. It might be worth a look.

Modbus will be suggested. I've not used it. It would be significant
overkill, but if there is free source to be had, then you'll not need
more than that to talk to a plasma cutter. Trying "modbus beaglebone
linux" gives enough hits to suggest that it would be feasible to drop a
beaglebone in on the Rx end, drop the code in, and maybe have it up in
an afternoon.

Erik

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to