Macintosh Serial input and output |
||||||||||||||||||||||||||||||||||||
| Macintosh computers no longer have serial output hardware (appart from the modem port), but OSX has a serial driver. The easiest way to get a serial port is to buy a Keyspan USB to serial converter (see photo) . To get it to work you will have to install a serial driver . The local agent for Keyspan is Fosh Australia. Keyspan has been bought by TrippLite. | ||||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||
| Step 1. Set up Keyspan USA-28x USB Twin Serial Adaptor | ![]() |
|||||||||||||||||||||||||||||||||||
| Serial assistant will show two ports | You can also check existence of ports with System Preferences -> Network | |||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||
Step 2. Test the serial link - you need
|
||||||||||||||||||||||||||||||||||||
Step 3. Download a dumb termial emulator
|
||||||||||||||||||||||||||||||||||||
![]() |
![]() |
|||||||||||||||||||||||||||||||||||
Step 4. Simple loop back test - if you wany to
Loop back connections for Mac DE9 cable on right |
![]() |
![]() |
||||||||||||||||||||||||||||||||||
Step 5. Choosing the external device
|
||||||||||||||||||||||||||||||||||||
![]() |
![]() |
![]() |
||||||||||||||||||||||||||||||||||
Step 6. Make a cable to connect the LCD display to the Keyspan USA-28X
|
||||||||||||||||||||||||||||||||||||
![]() |
![]() |
|||||||||||||||||||||||||||||||||||
| Wires are colour coded One end matches pin numbers Other end swapped
|
||||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||
Step 7. Test the serial link
|
||||||||||||||||||||||||||||||||||||
| Step 8. Write a program to send characters to the LCD | ||||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||
| If you are having problems with VISA with Intel Macs - VISA Find Resource.vi and VISA resource name selector, try using a string constant instead.
LoopBackTest.vi uses a string but only finds 1 of the 2 Keyspan ports. See: file for information on using LabVIEW with Intel Macs |
||||||||||||||||||||||||||||||||||||
![]() |
A LabVIEW program consists of two parts:
|
|||||||||||||||||||||||||||||||||||
| You can download this program
WriteStringLCD.vi (56Kb) - CTRL click to get file |
||||||||||||||||||||||||||||||||||||
Algorithm:
|
||||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||
Macintosh Java serial |
||||||||||||||||||||||||||||||||||||
| Java can use serial i/o if a serial library is installed. Two libraries have been defined for use with Java: Javax.com and GNU.io. Code for developing serial in Java can be obtained from SerialIO and RXTX | ||||||||||||||||||||||||||||||||||||
| RXTX produces both a Javax.com library ( rxtx-2.0-7pre1) and a gnu.io library (rxtx-2.1-7r2.zip (Final)) for Download. The folllowing instructions are for Version 2.1.7 with the assumption that you can recompile your application to use gnu.io. The installation for Version 2.0 is different. Both can be painful. | ||||||||||||||||||||||||||||||||||||
Installing and testing gnu.io |
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||
| Keyspan USB to serial port with 2 loopback cables
Inside: Apple serial cable Outside: DE9 DCE loop back cable |
||||||||||||||||||||||||||||||||||||
| Testing Java Serial | ||||||||||||||||||||||||||||||||||||
|
Example programs can be found on the RXTX and Javax.com web sites. These can be used for loopback tests or as serial applications. Note: the use of import gnu.io.*; instead of //import javax.comm.*; SerialDemo is a Java Swing application that displays a GUI to enable you to select a port and open it, and experiment with various port settings. It is set to no echo, so characters you type on the top pannel will appear on the bottom pannel when a loopback cable is connected. When connected to a serial device, it will support bi-directional interaction. An XCode project is available for download. (100kb .sitx) (.sitx files can be expanded with Stuffit expander from Allume Systems) |
||||||||||||||||||||||||||||||||||||
| Serial Demo Run Log
[Session started at 2006-07-18 10:05:24 +1000.] |
||||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||
| TwoWaySerialComm Run log
[Session started at 2006-07-18 10:16:34 +1000.] |
||||||||||||||||||||||||||||||||||||
| A second program: TwoWaySerialCom (XCode project, .sitx 60Kb) shows how to write a serial connection without a GUI - NOTE: you have to hard code the port name in line 164. | ||||||||||||||||||||||||||||||||||||
Cocoa Serial Programming |
||||||||||||||||||||||||||||||||||||
| Two classes for accessing serial ports are available for download from harmless in Germany | ||||||||||||||||||||||||||||||||||||
Macintosh wireless cable replacement |
||||||||||||||||||||||||||||||||||||
| Severalcompanies offer wireless serial links based on Bluetooth technology, such as the BCR01 from Air2u shown connected to a Macintosh on left and the other end to the EiMU INS sensor from CSIRO on the right. BCR01 is available in Australia as a Cable Replacement Kit. | ||||||||||||||||||||||||||||||||||||
![]() |
![]() |
|||||||||||||||||||||||||||||||||||
| The kit comes with two transceivers both with DTE male connectors and a null modem connector to change one to a DCE. A null modem crosses over the rx and tx signals | ||||||||||||||||||||||||||||||||||||
![]() |
![]() |
|||||||||||||||||||||||||||||||||||
| The kit comes with a Windows application for changing the settings from the default: 115200 baud, flow control ON, handshake ON.
Probably uses a hardware line (DTR?) to switch to configuration mode so that it can use the serial line to talk to the Bluetooth card. |
||||||||||||||||||||||||||||||||||||
| A loopback connector may be used with Zterm to test whether the wireless link is working | RS232 signals are named from the DTE point of view.
|
|||||||||||||||||||||||||||||||||||
![]() |
![]() |
|||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||
| Cable used in photo above to connect to mac DE9 cable | ||||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||
Emulating an IBM PC Serial Port |
||||||||||||||||||||||||||||||||||||
Many devices come with a DE9 socket ready to plug into an IBM PC serial port
|
||||||||||||||||||||||||||||||||||||
| Wiretek make a single port USB to serial cable with the Prolific chip
A Mac OSX driver can be downloaded Programming is the same as for the Keyspan, except that the VISA serial close vi will cause a fail to open on subsequent runs, so it has to be removed. |
![]() |
|||||||||||||||||||||||||||||||||||
| Another way to emulate a PC port is to make a cable to plug into the Keyspan
Note: the Mac serial port (mini-DIN 8) is only ± 5volts while the PC (DE9) is ± 12 Volts
|
||||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||
| Return to Phillip McKerrow or site Index | ||||||||||||||||||||||||||||||||||||
| Page updated Friday 26th August 2009 | ||||||||||||||||||||||||||||||||||||