Software for My PLC

I was thinking of just the message format and the TTY versus socket issues. I hadn't considered message timing, so you have a good point there. Modbus/TCP doesn't have worry about timing as those sorts of issues are up to TCP/IP to take care of. If your rack controller doesn't need "silent periods" between polls you will probably get better throughput as well.

I found a couple of web sites that discuss how they handle Modbus through USB. The first one uses Modbus/RTU:
http://www.fieldofcows.com/index.php?title=USB_Modbus_Interface
This is a board that someone made to do a CNC retrofit.

The second uses Modbus/TCP:
http://labjack.com/support/modbus
This something called LabJack, and in this case they also provide a program which re-directs the socket interface over USB.

Both of these have source code that you may want to look at.
 
C

curt wuollet

It almost makes me wish I had ordered a USB Freeduino rather than a serial one. That actually makes the point moot for the time being. But someone could get deep into research on the matter for about $25. Once I get the FD running the I/O, that's one of many directions for others to follow who have need of such a thing. In the short term, if I want to send data to/from the PC I could use a simple obvious protocol like slot number, hi byte, low byte, wrapped in the usual ack/nak and lrc check. That's if someone hasn't patented it:^) Once the hardware works, I can do more. The way SPI works there isn't much difference between a slot read and a slot write, for a write you just throw the receive buffer away. Both ends need to know which cards are inputs and which are outputs. I'm thinking of writing config data to the on board EEPROM because I hate PLCs that keep important info on the PC. I don't want to get too elaborate as I don't see the FD as a permanent processor for my purposes. But I agree that it would be fine for many uses and is something a lot of people like to work with. I'm sure a PIC version would make some folks happy too. But I want a Linux based PLC in the end. I have to focus on the parts that don't already exist.

Regards
cww
 
C

curt wuollet

I know I wasn't gonna worry about this, but digging around for other bits and pieces, I ran across it. Sparkfun has a USB to PCI adapter for $25 that would let you talk to the rack from your PC. They call it their SPI shortcut.

http://www.sparkfun.com/datasheets/Tools/spishortcutDS.pdf

They mention using it with a terminal emulator so I expect one could also open /dev/USBX in C and write civilized software for whatever purpose with the protocol on the wire being native SPI.

They also have a more versatile gadget called the bus pirate. It's $29 and talks PCI, I2C and others as well.

http://www.sparkfun.com/datasheets/Tools/spishortcutDS.pdf

I haven't used these and have no interest in the companies, but this and a FreePLC would be a pretty cheap and easy way to add real industrial IO to your PC.

Got the second Freeduino built and working and waiting for the silicon from Newark to arrive.

Regards
cww
 
Top