Sharing a serial port between 2 apps?

Discussion in 'macOS' started by kc5deb, Mar 24, 2011.

  1. kc5deb macrumors newbie

    Joined:
    Jan 10, 2009
    #1
    I am needing to share one serial port between two apps.

    Basically, the serial port is connected to a piece of equipment, and I am wanting two programs to be able to communicate with the equipment at the same time.

    Possible or pipe dream?
     
  2. iVoid macrumors 65816

    Joined:
    Jan 9, 2007
    #2
    You'd probably have to write one program to talk to the serial device directly and then one or more programs that talk the the first program and have it do the talking.
     
  3. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #3
    Possible but you'll need to write some code to allow this to happen.
     
  4. old-wiz macrumors G3

    Joined:
    Mar 26, 2008
    Location:
    West Suburban Boston Ma
    #4
    Mac with serial port? Don't know of any current Macs with serial ports.

    What kind of Mac? What version of the os?
     
  5. talmy macrumors 601

    talmy

    Joined:
    Oct 26, 2009
    Location:
    Oregon
    #5
    I do it all the time using a USB to RS232 adapter and added drivers.

    But as far as the OP is concerned, I've only managed to do it with one app at a time because opening the port locks access. If you are doing your own programming you could write a little program that opens the serial port and transfers data to other programs via pipes.
     
  6. MisterMe macrumors G4

    MisterMe

    Joined:
    Jul 17, 2002
    Location:
    USA
    #6
    No, you don't. Having two different programs communicating with the same serial device is asking for trouble. The major problem is that your two programs will have different datasets. Depending on the variability of the data, you may miss important information. You want one program to handle the communications. As iVoid said, the communications program can, in turn, pipe data to other programs that need it.

    If you are talking about using a Mac to communicate with the equipment, then you need a USB-to-serial converter cable. Even on Windows PCs, serial ports are vanishing if they have not vanished already. If you are using a new Windows computer, then you will probably need the converter cable.

    For scientific and engineering applications, National Instruments LabView originated and grew-up on the Mac. It handles multiple instruments in an integrated instrument control and data flow and analysis. If your instrument is not included in its library, then you may program it yourself. Student versions are available.
     

Share This Page