Controlling Ifos from Mac OS X
More progress on my Mac development path migration: I can now control Ifos slaves from my iMac. This is the culmination of a few related successes, and means:
- The Mac sees and can use my USB-to-Serial cable
ruby-serialportis installed and working
- My tiny Modbus master in Ruby is working
- The Ifos slave still works (you never know with these “invention”-type thing-a-bobs)
Related, but not specifically required for basic Ifos control via Modbus/Ruby:
- javax.comm is installed and working
There were a few things I had to do:
1) Install ruby-serialport. This is a gem now (that’s cool), so installation was trivial. I had to update RubyGems first, though—the version installed by default was slightly too old:
2) Include rubygems in modbus.rb. Not unexpected (and a small price to pay) now that we benefit from the new gem nature of serialport. Not much to the diff:
3) Open the serial port by name instead of number. On the PC, numbered COM ports correspond to the serial ports (COM1, COM2, etc.). OS X uses filesystem names, like other *nixes (e.g.
/dev/tty.Modem). My USB-to-Serial cable is accessible at
/dev/tty.PL2303-0000201A, so I that’s what I pass to my Modbus master. Here I create a Modbus master on the serial port at 19200 baud in ASCII mode, then write 1 to register 0 on device 3 (turn on LED 0 at lowest intensity red):
Now that I know can control Ifos from the Mac, I can start on the more difficult task of controlling it from the TINI.