[Linux] Serial Ports

Hi,
are the PC Com1 & Com2
serial Ports still supported
under LV Linux version ?
I dont find the Serial Port VIs anymore ?
The idea was to move a LV .vi from WinX to Linux.............
any experiences ?

In both Windows and Linux, you are supposed to use the VISA functions. It's almost the same, and there is a compatibility menu, with wrapper VI's that simulate the old functions. I'm currently developing an application in windows (old habbits die hard), and I'm running it under Linux without any serial problems.
Regards,
Wiebe.

Similar Messages

  • Porting VIs to Linux, serial port support

    hello,
    I have installed LabVIEW 7 Express on
    Mandriva Linux
    Porting VIs Sources works well
    I had some VIs under Windows using the PC
    Serial Port, under LabVIEW 5, using the NI serpdrv file.
    Until now, unable to make run the Serial Ports
    in the Linux Version of LabVIEW....................
    any hints ?

    Hi trallala-
    Read the following KnowledgeBase articles and reply if they do not help resolve your problems.
    Troubleshooting Serial Communication in Linux
    How Do I Access The Serial Ports of My Linux Machine Without Admin Privileges?
    What Linux Distributions do National Instruments' Drivers and Software Support?
    Hope this helps!
    Drew Pierce | District Manager, Central Texas | National Instruments

  • KM2M serial port not working in Linux

    I noticed a few Linux postings so I thought I'd give this a shot. I'm running Fedora Core and for some strange reason I can't seem to send any communications out to the ttyS0 (COM 1) or ttyS1 (COM 2) ports.
    Does anyone have any suggestions on making it work?
    Thank you.

    No, your code had no termination characters at all - automatic or not. The enable termination character for the VISA Configure Serial Port is only for reads. Just like the help explains.
    And while you should check the download page for updates, LabVIEW comes with the 34401 driver.
    Message Edited by Dennis Knutson on 12-19-2009 05:49 PM

  • LV acquire the print information from the embed board with Linux system through serial port

    I want to acquire the print information by LV from the embed board with Linux system through serial port, like the window hyperterminal tool?
    I try to use VISA serial config function to achieve it ,but lost and prompt that is error like attachment.
    I can't sure that my idea is reasonable.
    help me
    thanks a lot!

    I ended up finding the answer to my problem. After pointing a client directly at one of the DPS systems, I saw the following error in the logs:
    [27/Jul/2009:17:11:47 -0400] - OPERATION  - INFO  - conn=3688 op=4 BIND RESPONSE err=12 msg="The server is not configured to pass through control 1.3.6.1.4.1.42.2.27.8.5.1" etime=0After adding that control OID to the allowed-ldap-controls, I could login via password auth. Adding this control also allowed for password changes to work from a client system.

  • Serial Ports, is it supported on MAC & Linux ??

    Hey all...
    After a long process of doing an application that runs a serial port connection to a server and upload a file to it, i could'nt find the comm package that i could download for both MAC and Linux.... There is one for Windows and Solaris though... So i was wondering, is serial ports not supported by MAC and Linux. And if not, what other than the comm package can i use to have serial ports on those 2 platforms .......
    Thanks

    Yes, there is third party support for linux and MacOS-X. It's released under GPL and can be found here -> http://www.rxtx.org/

  • Serial Port - Linux OK, Windows No Way

    I have been trying to write to my serial port with hardware flowcontrol under windows XP all weekend. With no flow control all is well. I was about to give up on my serial port program when I decided to try my sample app under Linux Redaht 8 using the RXTX commapi. To my surprise, the code that would not work under windows worked just fine under Linux! I'm happy and confused at the same time. Here's the code snippet that processes the serial events. Does anyone have any insight into why this simple write with flow control would not work under windows XP? I have LED's connected to the serial lines and can see the CTS line doing what it's supposed to. I have administrative rights on XP. A few observations that probably mean nothing. Windows XP repors outputbuffersize=0, yet Linux returns a value. The API notes say it is advisory and may not report a value so I don't think it means anything.
    ANY help you have would be greatly appreciated.
    Thank You!
    public void serialEvent(SerialPortEvent event) {
            long timein,timeout;
              switch(event.getEventType()) {
                   case SerialPortEvent.BI:
                   case SerialPortEvent.OE:
                   case SerialPortEvent.FE:
                   case SerialPortEvent.PE:
                   case SerialPortEvent.CD:
                   case SerialPortEvent.CTS:
                        if(boolDataforWriting & event.getNewValue()){
                                  //Write data
                             timein=System.currentTimeMillis();
                             try {
    // ########## LINE THAT PRODUCES ERROR IN WINDOWS BUT NOT LINUX ###########
                                                    streamSerialOut.write(strDataForWriting.getBytes());
                             } catch (IOException e) {
                                  e.printStackTrace(); 
                             }//end catch
                             System.out.println("-->Done writing " +strDataForWriting.length()+" Bytes. Resetting str");
                                   timeout=System.currentTimeMillis();
                                   System.out.println("--->Time to write="+ (timeout-timein) + " ms");
                             //reset flags for next write operation
                             strDataForWriting="";
                             boolDataforWriting=false;
                        }//end if
                   case SerialPortEvent.DSR:
                   case SerialPortEvent.RI:
                   case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
                        break;
                   case SerialPortEvent.DATA_AVAILABLE:
                        try {
                                       byte[] readBuffer = new byte[100]; //create byte array
                                      char c;
                                      int numBytes=0;
                            while (streamSerialIn.available() > 0) {
                                     numBytes = streamSerialIn.read(readBuffer);
                                   } catch (IOException e) {}
                             break;
                                    String strtemp=(new String(readBuffer)).trim();
    }//end serialevent

    I've had this very same problem and there is a solution.
    Interestiingly I found that the same code worked on Win98 but not WinXP.
    The problem seems to lie in the JavaComm implementation. I'm guessing but your probably running with the javacomm20-win32.zip that you downloaded from Sun. I've also tried using the implementation javacom that IBM provide with there download of java1.3 and it has the same problem. So you should have a look at http://www.rxtx.org I've had success running this implementation on WinXP and Linux. To save you some time compiling there is a reasonably recent binary version at this location http://www.jcontrol.org/html/en/download.html (scroll to the bottom of the page)

  • Problem communicating via serial port in Linux

    Hello,
    I am trying to transfer data via serial port, in Linux.
    But it is impossible till now!
    I get Runtime exception.
    Here is my code:
    public class Main {
        public Main() {
        int num=5;
        int[] array = new int[5];
        public static void main(String args[])  {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    array[0]=1;
                    array[1]=2;
                    array[2]=3;
                    array[3]=4;
                    array[4]=5;
                    new ParallelCommunication(num,array);
    import java.io.*;
    import java.util.*;
    import javax.comm.*; // for SUN's serial/parallel port libraries
    //import gnu.io.*; // for rxtxSerial library
    public class ParallelCommunication implements Runnable, SerialPortEventListener {
       static CommPortIdentifier portId;
       static CommPortIdentifier saveportId;
       static Enumeration portList;
       InputStream inputStream;
       SerialPort serialPort;
       Thread readThread;
       static OutputStream outputStream;
       static boolean outputBufferEmptyFlag = false;
       int num;
       int[] array;
       public ParallelCommunication(int this_num,int[] this_array) {
          boolean portFound = false;
          String defaultPort;
          num = this_num;
         array=new int[this_array.length];     
          array = this_array;     
          // determine the name of the serial port on several operating systems
          String osname = System.getProperty("os.name","").toLowerCase();
          if ( osname.startsWith("windows") ) {
             // windows
             defaultPort = "COM1";
          } else if (osname.startsWith("linux")) {
             // linux
            defaultPort = "/dev/ttyS0";
          } else {
             System.out.println("Sorry, your operating system is not supported");
             return;
    //      if (args.length > 0) {
    //         defaultPort = args[0];
          System.out.println("Set default port to "+defaultPort);
          // parse ports and if the default port is found, initialized the reader
          portList = CommPortIdentifier.getPortIdentifiers();
          while (portList.hasMoreElements()) {
             portId = (CommPortIdentifier) portList.nextElement();
             if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                if (portId.getName().equals(defaultPort)) {
                   System.out.println("Found port: "+defaultPort);
                   portFound = true;
                   // init reader thread              
                   initialize();
                   break;
          if (!portFound) {
             System.out.println("port " + defaultPort + " not found.");
       public void initwritetoport() {
          // initwritetoport() assumes that the port has already been opened and
          //    initialized by "public void initialize()"
          try {
             // get the outputstream
             outputStream = serialPort.getOutputStream();
          } catch (IOException e) {}
          try {
             // activate the OUTPUT_BUFFER_EMPTY notifier
             serialPort.notifyOnOutputEmpty(true);
          } catch (Exception e) {
             System.out.println("Error setting event notification");
             System.out.println(e.toString());
             System.exit(-1);
       public void writetoport(int counter) {
          try {
             // write string to serial port
             outputStream.write(String.valueOf(array[counter]).getBytes());
          } catch (IOException e) {}
       public void initialize() {
          // initalize serial port
          try {
             serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
          } catch (PortInUseException e) {System.out.println("Port In Use.");}  //******Here is the Exception******
          try {
             inputStream = serialPort.getInputStream();
          } catch (IOException e) {}
          try {
             serialPort.addEventListener(this);
          } catch (TooManyListenersException e) {}
          // activate the DATA_AVAILABLE notifier
          serialPort.notifyOnDataAvailable(true);
          try {
             // set port parameters
             serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
                         SerialPort.STOPBITS_1,
                         SerialPort.PARITY_NONE);
          } catch (UnsupportedCommOperationException e) {}
          // start the read thread
          readThread = new Thread(this);
          readThread.start();
       public void run() {
          // first thing in the thread, we initialize the write operation
         initwritetoport();     
         for(int i=0; i<=num_of_inputs; i++) {
            // write string to port, the serialEvent will read it
            writetoport(i);
         serialPort.close();     
       public void serialEvent(SerialPortEvent event) {
          switch (event.getEventType()) {
          case SerialPortEvent.BI:
          case SerialPortEvent.OE:
          case SerialPortEvent.FE:
          case SerialPortEvent.PE:
          case SerialPortEvent.CD:
          case SerialPortEvent.CTS:
          case SerialPortEvent.DSR:
          case SerialPortEvent.RI:
          case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
             break;
          case SerialPortEvent.DATA_AVAILABLE:
             // we get here if data has been received
             byte[] readBuffer = new byte[20];
             try {
                // read data
                while (inputStream.available() > 0) {
                   int numBytes = inputStream.read(readBuffer);
                // print data
                String result  = new String(readBuffer);
                System.out.println("Read: "+result);
             } catch (IOException e) {}
             break;
    }...and the outcome is :
    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException:
    Error opening "/dev/ttyS0"
    tcgetattr(): Input/output error
    at com.sun.comm.LinuxDriver.getCommPort(LinuxDriver.java:66)
    at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:369)
    at ParallelCommunication.initialize(ParallelCommunication.java:128)
    I have searched a lot and I couldn't find a solution.
    Thank you.

    I'm having the same problem this helped somewhat debug the problem
    http://bloggerdigest.blogspot.com/2006/11/linux-serial-com-port-diagnostic-test.html
    I'm running Suse 10.3 and apparently it does not recognize my serial ports. So before
    you can test your Java code you have to figure out how to make linux see the ports.
    If I find a solution I'll let you know but if you find one first let me know. Thanks.

  • Using a serial port under j9.. How?

    I am trying out j9 on an ipaq. I am trying to get javax.comm to work.
    When I call CommPortIdentifier.getIdentifiers ();
    I get java.lang.string.NoSuchMethodError: java/lang/String.<init>([BIII)V
    It would appear that the javax.comm package was implemented using a now deprecated String method, and that IBM has chosen not to implement deprecated methods in it's j9 vm (I get the same issue trying to run swing.)
    One would think that what is needed is an updated javax.comm package. However, there doesn't appear to be a javax.comm package on Sun's site, let alone an updated one. Whats going on here? Can someone give me an idea of how Sun and/or the JCP thinks about developers who want to use serial ports?
    Is there a workaround? A different way of talking to a serial port? Or should I abandon j9? I should add that I got my software running just fine on nsi.com's creme vm (javax.comm and swing too) and it worked without any hassles. It even understands jar files (is there a reason why IBM insists on having a link file?). However, the reason I persevered was that a) j9 is cheaper and more importantly b) nsi.com don't seem terribly keen on actually selling their product. I have lots of references to them selling their vm in bundles of 40 ($1000) which is a bit ouchy but hey I'm not paying for it. But, you'd think the nsi.com people would actually confirm this on their site?
    So.. can it be done? And why, in the world of embedded systems (my field) and now lots of phones and pdas, is so little attention given to the humble serial port? It doesn't matter how fancy the protocol is, underneath it all is a UART. grumble
    -Russel

    Hi Russel,
    I will probably soon be in the position you are in trying to get this to work. I found the following page which offers some promise.
    http://www.intrinsyc.com/support/I-Linux/405-cube/misc/smf_serial_port_access_example.htm
    Mike

  • Problem in using serial port.

    I am using serial port to get data from a fusion splicer. The number of bytes at the port is 4096 but the read buffer of VISA read is empty. I am reading the same number of bytes. Can any one tell me what is the maximum size of VISA Read buffer? I am trying to put the contents of the buffer in a file. I am using labVIEW 6.1 on linux.I am also attaching the VI.
    I also noticed this problem...If I read the number of bytes in the serial buffer many times, sometimes it reads it as 0 and I have to keep trying until it reads this 4096 bytes.
    Thanx for any help.
    S.Vijayalakshmi
    Attachments:
    serail_comm.vi ‏52 KB

    Hey Viji,
    In your application it looks like you are just checking to see how many bytes are at the serial port. Is it possible that your application is check for the serial data at the port before the data actually gets there. If you are looping this code as a subVI or just running it over and over it is possible that one of the iterations could occur faster than your device can write the information to the bus. In this instance you are checking the number of bytes at the port and there might not be any there yet. In this case the port reads 0 as you have designed it.
    If you want the read function to wait and always read 4096 then don't wire the bytes at port to the read function. Just wire a constant/control equal to 4096 to the read function instead o
    f the bytes at port. In this case, if there are not any bytes at the port the read function will wait for the bytes to show up or until the timeout period is reached.
    I would also, suggest lowering your time to something more reasonable, because if your instrument quits transmitting your application is going to wait for 33 minutes. That is a long time for a program to hang.
    I hope this helps out.
    JoshuaP
    National Instruments

  • Serial ports in Solaris 10

    Hi all. Please help me to solve my little problem. I need to get serial ports names (com-ports) registered in my system. In Linux I use command "dmesg | grep ttyS" for that, but in Solaris dmesg output don't contains any data about ttya, ttyb etc...
    And also one question. Does Solaris support USB->COM adapters, I have plugged adapters Prolific and FTDI, but they don't work.
    Regards, Alexey.

    user9068379 wrote:
    Hi all. Please help me to solve my little problem. I need to get serial ports names (com-ports) registered in my system. In Linux I use command "dmesg | grep ttyS" for that, but in Solaris dmesg output don't contains any data about ttya, ttyb etc...
    And also one question. Does Solaris support USB->COM adapters, I have plugged adapters Prolific and FTDI, but they don't work.
    Regards, Alexey.Talking extremely loosely, expect to find com ports as /dev/term/a , /dev/term/b ......
    You may also file the 'tip' program appropriate on solaris.
    This may be sufficent for you to progress ... or it may be you need something else.
    I have not done these things recently ... and ohers may guide mor eauthoratively and better.

  • Safe mode plus serial port

    My computer can only boot in the safe mode (logic board failure). No problem except I would like to have a serial port working. A USB external disk works fine. So how can it be made to work? Trying to load a kext for the serial port using terminal does not work. LoadKext does not add kext.
    What can be done here?

    "Logic Board Failure" usually indicates a large sub-system not a single item.  Like the whole USB system might be dead.  Or the whole PCI bus.  Or the sound system.  etc.
    I doubt Apple will encourage you to hack up OSX to bypass the dead hardware.  Its certailly possible to custom config FreeBSD/Darwin.  It might be beyound your comfort level though.
    A good experiment would be to download the current Ubuntu Linux Desktop Install CD (ubuntu.com).  Because this CD can also boot Ubuntu Linux Desktop so you can try it out.
    A handy way to see what is actually wrong, since the Ubuntu boot system tests all hardware.  Apple Hardware test would tell you what is wrong too.
    My point here is that if Ubuntu works, then you can wipe the drive and install that.  Because there is LOTS of documentation on the web for customizing Ubuntu, making it easy to NOT load a driver for the not working hardware.
    I wander around my neighborhood on garbage day and grab old computers that look undabled.  They are free.  And as I said, they have no trobule running Linux or FreeBSD.

  • Sending File Over Serial PORT

    Hi,
    I'm able to read/write data over serial port using Java Comm APIs in Linux.
    Can anybody please tell me how to write/read a file over Serial port?
    Is it similar to sending a file over network?
    An early response is appreciated...

    Same stream I/O as used over the port works from a file. Dead simple.
    Also dead slow. If you want to do large amounts of data, use a RandomAccessFile and read a big chunk at a time into a byte array. Then send the byte array.

  • Permission denied on Serial port open

    Hi all!
    I'm trying to open a serial port in a Linux machine and I get a RuntimeException in the open() method of CommPortIdentifier:
    Error opening "/dev/ttyS0"
    Permission deniedHow can i run the program as root or with root permissions?
    I'm running it from Eclipse.
    Thanks!

    I am trying to set this to the Mac (Admin) owner. The folder that is being shared over the network via samba was created on Mac OS

  • How to recognize Serial Port Device in Forms.

    Hi All,
    I am using Forms 6i. I want to know how to recognize a serial port device in forms. I have a requirement to recognize the reading of one serial port device into my form in my application and I have to store that reading value into database.
    How can I acheive this?
    Waiting for ur reply.
    Thanks in Advance.
    Gopinath Kona

    hello,
    i havent worked on Linux but have been extensively using it on windows.
    did you try running any code ?
    rohan

  • Can't open Serial port in notebook (use Serial to USB)

    OTL
    use Serial to USB and java communication 2.0, windows 2003
    and notebook which has no RS232C port
    testing desktop it is done.
    notebook does not work....
    How can i open serial port in notebook ...

    Saludos
    tengo el mismo problema, aunque he encontrado algunas
    API pero solo tienen soporte para LINUX:
    * jsr80 y
    * jUSB API
    Si tienen alguna solucion haganmela saber.In English via Babelfish (and a little common sense), in case anyone knows a solution:
    Greetings, I have the same problem, although I have found some API but they only have support for LINUX:
    * jsr80
    and
    * jUSB API
    If they have some solution I'd like to know.

Maybe you are looking for

  • Can't send mail to embark or centurylink mail

    Been having this problem for a month. I have been on phone with CS for a couple hours over this. So last nite I deleted all comcast and gmail accounts off all computers. Ran virus scans till I'm sick of looking at them. Also last nite I changed passw

  • My apple mac is not charging

    My MacBook doesn't seem to be charging when it's plugged into the power outlet. I have tried restarting, plugging it in again and other outlets...at least 3 times each. It was working earlier today.

  • Disabling Wireless Adapter

    I want to run a Powershell Startup Script to disable the Wireless adapters on some systems. I thought I'd want to get some WMI stuff Get-WmiObject -Class Win32_NetworkAdapter -Filter "Name = 'Intel(R) Centrino(R) Advanced-N 6205' Then run netsh to di

  • ITunes shuts down when I access TVShows

    I have downloaded a season of shows but when i select TV shows where it is stored I get the iTunes error and it shuts down my iTunes. I have changed the settings on my quicktime player, i have disabled proxy. Nothing is helping. I can still access al

  • How to bind ACS users to only one SSID?

    Hello! I have ACS 4.2 and AP 1240. I`m use two SSID - guest and user. Guest ssid must use PEAP authentication, user ssid must use EAT-TLS authentication (acs user local database). All work correctly. But when i create user for EAP-TLS, i`m create wit