Serial Communication RS232 and RS485
Sometimes you need an old fashion serial interface to receive data from or send data to a device with only a serial port. If a device has a serial port and an USB port but there is no USB driver for the Mac available then you can use the serial port or try to write your own USB driver. If the speed of the serial port is sufficient then it’s easier to write code for the serial port then to write an USB driver.
Mac’s don’t come standard with a serial RS232 or RS485 port but you can buy a serial adaptor to USB2.0.
Mac’s with a Thunderbolt port still have two USB3.0 ports and USB3.0 is backwards compatible to USB2.0.
I needed a RS485 interface to communicate with my GPS and FRG100 and a RS232 interface to communicate with the Svantek Sound Analyzer.
Serial to USB adapters come with a driver and for your application source code it’s a just serial port.
You only have to face the challenge to write software to read from and write data to the serial port.
Because serial communication is very common you aspect in de frameworks a nice serial class from Apple that you can use with Cocoa. Well there is the IO kit but I found it fare from simple and I did not see why I had to write code that should be standard. So I looked for free Cocoa Objective-C and Swift Classes for serial communication on the internet and found one which can be used.
In my latest developements I use an easy-to-use serial port library for Objective-C and Swift.
Click on ORSSerialport to download the source code.