Find serial port automaticly

Hi:
There is question that obsess me for a long time that is how can I find a serial port number of the pc automaticly.
when I use the advanced visa read and write vi that provided by the labview. The serial port number is presented as
a control and can be configured by the user.
But when I build the file as a .exe and the user is not familiar with the Pc(have no knowledge about the serial port).I want to
find the serial port automaticly by the program . How can I do it.
thanks for your help
aaa

First, I'll assume that NI-VISA is installed on the PC because it would be needed to do serial port communications.  When you use the control, it will give a list of all the ports on the PC in the dropdown list.
I'm not sure what you mean by find the serial port "automatically".  If the port is available, it will be on the list.  I don't think it is much work for a user to hit the drop down button and select the port they want.  They need to have that much control.  If the computer has more than one port, how is the PC supposed to know which one to pick automatically. 
If you have a specific com port in mind, such as Com1, you can save Com1 as a default in the control.

Similar Messages

  • I CAN NOT find serial port init.vi

    In labview8.6 , I CAN NOT find serial port init.vi.
    Other lots of icon can be found..... 

    Dennis Knutson wrote:
    for(imstuck) wrote:
    That's because it is called VISA Configure Serial Port. It is located in Instrument I/O->Visa->Visa->Visa Advanced-> Bus Interface Specific -> serial.
    And there it is. Sometimes you really gotta dig!
    You enjoy taking the long way there?
    Message Edited by Dennis Knutson on 05-20-2010 05:48 PM
     I just did a search of the palette and thats where it took me so thats what i posted to help the OP. Besides, sometimes the scenic route is nice. You pass lots of beautiful VIs on the way to your destination that you may have never known existed. And, I actually prefer the quick drop way .
    Message Edited by for(imstuck) on 05-20-2010 08:35 PM
    CLA, LabVIEW Versions 2010-2013

  • How to extract data from a .txt file & send it to a serial port automatically

    Hi all
    I'm a final yr B.Tech student. I am new to the entire LABVIEW thing. But i hear its really good. My dept. in collge has purchased labview & i'm tryng to use it
    As i'm new to labview , i need help plz
    " I want to open a .txt file (in my PC) & transmit all the contents of the file via serial (COM) port to an 89%! microcontroller. Also i want to read the feedback messages from the microcontroller thru the serial port & save it to the same file in the PC.All this must be done automatically. ie, no manual intervention after execution starts"
    Kindly help me as i'm stuck here & unable to proceed further with my project

    here is my 20min try without debugging (needs a rs232 and loopback connector )
    use the probe and highlight the dataflow to see how it works.
    as always:  there are many ways to solve your problem
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'
    Attachments:
    read write file to RS232.vi ‏69 KB

  • Question of commapi - BlackBox could not find serial port.

    Hi,
    I have installed jdk1.5.0_04 and commapi2.0_win32 at following directory
    c:\Java\netbeans-4.1
    c:\Java\jdk1.5.0_04
    c:\Java\commapi
    C:\Program Files\Java\jre1.5.0_04
    Then I do exactly what installation instruction ask me to do
    Copy win32com.dll to c:\Java\jdk1.5.0_04\bin
    Copy comm.jar to c:\Java\jdk1.5.0_04\lib
    Copy javax.comm.properties to c:\Java\jdk1.5.0_04\lib
    However, when I run BlackBox,BlackBox still gives me a message that
    says "No serial ports found!"
    Can any one help me out, thanks in advance ?
    Daniel

    Many forum posts about installation to java 1.4. Also see:
    http://forum.java.sun.com/thread.jspa?forumID=31&threadID=453195
    and
    http://forum.java.sun.com/thread.jspa?forumID=31&threadID=444673
    I had success on winXP when I installed to the JRE below Program Files/java, no success when installed to c:\j2sdk etc etc.
    The directions for setting the classpath seem bogus; I did not need to specify a class path. Simply went to the commapi/samples/BlackBox folder, then typed java BlackBox. It found a couple of ports. I think this means that (despite the post in the forum to the contrary) that the comm API can deal with the NT hardware abstraction layer (HAL) just fine.
    I'm very new to this, hope this helps.
    chris...

  • How to detect if my external device is connected to the Serial port

    Hi,
    If I remove the cable from the serial port in my pc or either remove the serial cable from my external device, then when I send a request to open the serial port from my program, it basically does nothing, it just sits there.
    I want to be able to show some sort of message or any other way of indicating to the user that they should check the cable.
    below is the bit of code to open and set serial port params:
         public void openPort() {
              // Initialise the drivers
              System.setSecurityManager(null);
              String driverName = "com.sun.comm.Win32Driver";
              try {
                   CommDriver commdriver = (CommDriver) Class.forName(driverName)
                             .newInstance();
                   commdriver.initialize();
              } catch (Exception e2) {
                   e2.printStackTrace();
              // port will be set in Store Operations.
              String wantedPortName = Configuration
                        .getParameter(ConfigSetting.EFT_COM_PORT);
              //System.out.println("wantedPortname : " + wantedPortName);
              Enumeration portIdentifiers = CommPortIdentifier.getPortIdentifiers();
              CommPortIdentifier portId = null; // will be set if port found
              while (portIdentifiers.hasMoreElements()) {
                   System.out.println("counter");
                   CommPortIdentifier pid = (CommPortIdentifier) portIdentifiers
                             .nextElement();
                   System.out.println(pid.getName());
                   if (pid.getPortType() == CommPortIdentifier.PORT_SERIAL
                             && pid.getName().equals(wantedPortName)) {
                        portId = pid;
                        System.out.println("found a macth");
                        break;
              } // end of while
              if (portId == null) {
                   System.err.println("Could not find serial port " + wantedPortName);
                   //System.exit(1);
              try {
                   port = (SerialPort) portId.open("EFTDriver", // Name of the
                                                                               // application
                                                                               // asking for the
                                                                               // port
                             10000 // Wait max. 10 sec. to acquire port
              } catch (PortInUseException e) {
                   e.printStackTrace();
                   System.err.println("Port already in use: " + e);
                   //System.exit(1);
              // Now we are granted exclusive access to the particular serial
              // port. We can configure it and obtain input and output streams.
              try {
                        port.setSerialPortParams(9600, SerialPort.DATABITS_8,
                             SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
              } catch (UnsupportedCommOperationException usc) {
                   System.err.println("Unsupported operation" + usc);
              }Please advise what method can I use for this purpose.
    Thanks
    Abhi

    You mean it hangs in the open() method despite the timeout?

  • Hola!!!Yesterday, I asked a question about serial port comunication, because I wanted to find a function in Labview similar to "ProcessSystem Events" in Labwindows!!

    My problem is that I have written a comand through the serial port, and I doesn´t receive the answer. If I execute the programm step by step, I don´t have any problem but if the program runs i don´t get the answer!!!It is not a problem of the bytes that I write and receive, i have used the function "Visa Bytes at Serial Port"!!I have used th function "wait" but it doesn´t work!!!!i have used a Flat sequence but it hasn´t solved the problem!!so, i don´t know what i can do!!!
    I attach the "different versions" that i did, maybe someone find a solution!!
    Dennis, I have the problem, when
    I read the last time in the program, I don´t receive the answer!thank you!!!
    Gracinda
    Attachments:
    salida_analogica.vi ‏67 KB
    config_rango.vi ‏41 KB
    salida_ana_v1.vi ‏69 KB

    Dear Mads;
    Thank you for your answer.
    I don´t have a termination character but I know the number of bytes that I have to receive. I tried checking the number of bytes that I received, using "Bytes at Port", but it gets a value and it isn´t refreshed, it has a value so my program stop in the while structure that I have added. I attach the vi. I don´t know how to do that. I am starting with Labview, and it is a little difficult for me!!
    In the first change that I did, I added the function "Bytes at Port" inside the While loops, but it doesn´t work either !!!
    Thank you!
    Attachments:
    entrada_analogica.vi ‏94 KB

  • Can't find a PCI-serial port

    Hello:
    I am using a PCI-Serial card to control a serial-port stage, I can not find the serial port with Labview8.0. Windows can find this serial port. When I use the same Labview program in my old computer which has a serial port on board, it can be recognized. Shall I change something of the 'Visa serial' communication module?
    The attached file is a Labview programmed driver for a motor-stage.
    Thanks,
    Attachments:
    ZaberLabview8Demo.zip ‏77 KB

    If Windows can't find the serial port, then LabVIEW isn't going to find it, and it's irrelevant what you've coded. You should go into the Windows Device Manager to see what it tells you about the device. Does it even show up in the list of devices? Does it have a driver loaded? If it doesn't show up in Device Manager, try plugging the card into another PCI slot. Does the card show up if you plug it into another computer? Perhaps the card is bad.

  • Automatically detect a Printer plugged to a serial port?

    Hello, is there a way for me to automatically detect with java if a printer is plugged in to a serial port (and if so, which one) on my computer.
    I am using javax.comm, but there is no such feature in there.
    Thanks in advance.

    I am not very familiar with this area but I am 99% sure you wouldn't get a signal to tell you are printer had been plugged in to a serial port.
    Your best bet is to spawn a new thread that polls the serial port looking for a new printer.
    Not very pretty I admit but it shouldn't be to hard to do.

  • Finder message: serial port in use by another application

    After giving a print command, I had a power outage with my application open. The computer tells me I
    cannot print my document because the serial port is in use by another application. I have opened and closed each application to no avail. The printer has nothing in the cache. I suspect the power outage
    left me in limbo with the original command, but I don't know how to get out of it to print the document.
    Just so you know, I am not a computer wiz kid. I don't understand how or why anything works. I can,
    however follow instructions. Can anyone one help?

    Have you tried a Shut Down & Restart? This will close all applications.
    Haven't booted into OS 9 for a long time, but try moving Appletalk to remote under Control Panels.
     Cheers, Tom

  • Locking access to serial ports

    I have two instruments on serial ports, and two independant VIs to control them. One VI may be running, or both, at any one time. The VIs may be running under LabView, or executables.
    I would like some simple and elegant way of ensuring that when I run the second VI, it cannot access whichever port is being used by the first VI. I have experimented with using the VISA Lock Async.vi, which should do exactly that. However, it seems to be possible to have two VIs lock access to the same port, without generating an error. I can only assume that the "lock" is for the application (LabView), not the VIs.
    I have looked at the synchronisation functions for a solution, but I can't see any reasonable way of using them. Semaphores are ok if you want to control access to a single port, but not the undefined list of ports that may be available on any given machine.
    I could use a global array variable containing a list of ports in use. Not very elegant though...

    CDancer a écrit:
    Thanks, guys, but I don't think you have understood my problem. Read the first sentence - 2 completely independant VIs, and 2 or more ports...
    I have written a program today using the globals option, which works very well. There should be a better way though.
    Chris
    ViLabWorks a écrit:
    It isn't exactly clear to me why this is about one port. How much does one serial port cost versus programming time? Or even if it is about 4 serial ports the same applies. For me there is no question, doing something perhaps difficult versus spending next to nothing to solve the problem.
    Well...
    Sometimes you need to access the same equipement from different places in your application, or from different applications...
    Usually I simply set/read a global "busy" boolean.
    One problem I would like to adress is the automatic detection of specific serial hardware. How is it possible to find the port on which some equipment has been connected ? Of course, a solution would be to try to connect to this equipment by sending a command and waiting for the proper answer. However, before doing that, you need to detect the available ports (VISA Find Ressource), then scan each port after setting the proper baud rate, byte length, parity, etc..., then close the port to make it available to another application. Unfortunately, within LabVIEW, this procedure may interfere with other vis already connected to other serial equipments, with impredictable results.
    Apart the solution proposed in my first post, I don't know a way of deciding if a port is already in use. May be I missed something ?
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Serial Port Overrun

    Hello All,
    I am developing Teststand sequences which run Labview code. I use 1 labview vi to configure and drive the serial port, the first call configures the serial port. The second call writes a message and reads the response, the last call releases the resource. When running the call write&read I intermittently receive the error shown in the attached jpg, this causes my whole sequence to lockup till I return to restart the test. I need to run this repeatedly overnight so its a problem. I have a feeling this isnt so much a serial port overrun problem as a hardware clash ( i also configure and run a camera ).
    I have spotted a number of posts a on this same topic but I havent yet found a soultion only advice, which I have already tried.
    Help greatly appreciated
    Regards Chris
    Attachments:
    Serial Port Error.jpg ‏63 KB

    Are you familiar with handshaking?  There were several posts on this subject recently.  The end device is sending data faster than your computer and Labview program can handle.  You need to implement handshaking.  There are two types of handshaking, software and hardware:
    Software, also called XON/XOFF.  With this setup, when the computer serial port incoming buffer gets nearly full, it automatically sends an XOFF command (don't worry about what it is since it is automatic).  The XOFF command tells the endpoint device to stop sending data.  When the buffer gets near empty, the computer sends an XON command.  The endpoint device then starts sending data again.  For this protocol, the endpoint device must be able to support this, and must be configured to use this type of handshaking.  You would have to read the manual to find out how to set it up.  For the computer end, you can set it up with an option for the configure serial port function on the input labeled "Flow Control".  Right click on this terminal and select Create - Constant.  A text ring will be created.  Select XON/XOFF in the text ring.
    Hardware, also called RTS/CTS.  Same principle in that the computer signals the endpoint when to stop sending data and when to start again.  However, instead of sending a command, the computer drops the CTS line (Clear To Send).  Actually, the endpoint device raises the RTS (Request To Send) when it wants to send data, and the computer responds with raising CTS if it is ready to receive data.  When the buffers get full, the computer drops CTS which tells the endpoint to stop sending data.  When the computer is ready to start receiving again, it raises CTS.  Again, both sides must be configured for this.  The text ring has an RTS/CTS selection.
    You will have to read the manual on your endpoint device to see what it supports and how to configure it.  Warning:  If sending binary data, DO NOT use XON/XOFF.  The binary data may just happen to form a pattern that looks like XOFF, and everything will lock up because XON will never be sent.  So if binary data is being transferred, use RTS/CTS.  If normal ASCII characters are being sent, you can use either protocol.
    - tbob
    Inventor of the WORM Global

  • File transfer of larger size through serial port

    Hi
    I need to transfer files of larger size may be around 20Kb through serial port. Can some one suggest some idea or can provide any sample VI for achieving this. i guess we cannot send the complete file at a stretch, so we may need to form some packets and then send. If i am right i need some help for achieving this.
    Padhu

    You may want to use something like the XMODEM protocol. 
    I believe you can find a version of XMODEM that can be used with an NI-VISA session located here on the OpenG forums.
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Problem on WinXP / Labview 6.1 with VISA (serial port)

    There is a problem on WinXP / Labview 6.1 with VISA which i use to poll the state lines of the serial port. The only functions that i use are "VISA Open", "Find Resource", line state properties and "VISA close".
    On my own machine (WinME) it works fine as a standalone application (with runtime engine in the same direction), even if i rename the Labview directory so that Labview is not found.
    From my VXIpnp directory i deleted all but these files:
    directory "Win95",
    subdirectory "Bin" containing "NiViAsrl.dll",
    subdirectory "NIvisa" containing "visaconf.dll".
    When shipping this to WinXP (and copying "VXIpnp" to the root directory), the serial port was not found, so i renamed the direction "Win95" to "
    WinNT", but this did not work also.
    I installed the VISA server, although it seems not to be required -- no result.
    Final question:
    What must i do for distributing the program as a standalone application for all windows platforms?

    Hey Joachim,
    In order to create an installer that includes the VISA Run-time engine for serial IO you will have to purchase LabVIEW 7.x. See screen shot. This packages a small compact version of the run-time that can only be used for serial, but it takes up much less space. The installer that I created has my application, the LV Run-time, and the VISA run-time and it is about 26 MB.
    That is much smaller than if I had to include the 32 MB LV 7.1 run-time and the 14 MB VISA run-time separately. It would have been even smaller if I would have uncheck some of the items that I wasn't using.
    -Josh
    Attachments:
    advanced.JPG ‏31 KB

  • How do I process serial port strings as bits

    In response to my commands, my instrument is sending bytes to my serial
    port. In one instance, 2 bytes are received. I want to treat these 2 bytes
    as a group of 16 bits.
    The VISA and Compatibility Serial functions return these bytes from the
    serial port to Labview clearly labelled a "string".
    Everything I can find in the way of Labview functions and .vis don't want to
    do bit twiddling, bit swapping, and bit dropping, with "string" data.
    I thought "hex string to number" could be used here, but I can't find a way.
    The 2 Bytes in question can be represented as hex, but the data are not the
    ASCII codes for the hex representation of a binary number, they are the
    binary number. This "hex string to number" seems to want ASCII c
    odes.
    You can feed a hex number typed into a "control" box wired into "hex string
    to number" and you get a meaningful number. You can feed the 2 bytes from
    the serial port into an "indicator" set to read in hex and you get a hex
    number that is a correct representation. But that is Labview handing them
    around to itself. I need to get my "hands" on them.
    I can't feed those same bytes that show up as a correct hex representation
    in an indicator into the "hex string to number" or anything else, so far,
    and get a number that is useful for further processing.
    I thought "variant to data", but I can't find enough reference material to
    understand how to use it. A boolean array seems like a bit of a weird
    approach, so I thought I'd ask before I looked into that.
    I'm used to dealing directly with binary numbers on the processor stack, I
    call them whatever I want, and turn them into anything I feel like.
    I'm sure I'm staring the solution in the face, but I can't find any way to
    persuade
    Labview to treat this "string" data as 16 bits.
    I've got the 16 bits, which is better than not having them, but I don't have
    much hair left.

    duh, well I finally discovered the "Unflatten from String" function. A guy
    just feeds in the bytes he's collected from his serial port that Labview
    thinks are a "string", and out come lovely little unsigned 16 bit numbers,
    or whatever other type of number he wants to turn the bytes into. And there
    are great little bit twiddlers available after that, like "swap bytes", and
    you can mask out bits with the logic operators, why this is fun. There's
    nothing like being a moron...... fly me to the moon...................
    "David Lewis" wrote in message
    news:[email protected]..
    > The two bytes would come from a serial port read.vi in Labview, classed as
    a
    > string. For instance, D3 and 02. The output wou
    ld swap the two bytes,
    i.e.
    > to 02 and D3, consider the two swapped bytes as 16 bits, drop the six most
    > significant bits, and output the ten bits that are left as an integer
    > classed by Labview as some kind of number, not a string.
    >
    > Your example StringToBits_Converter.vi I found on the ni.com site
    > unfortunately gives an error message and refuses to open on my system
    saying
    > it comes from a newer version of Labview 6 than I am running. Mine says
    > 6.0.1b3. Thank you very much anyway.
    >
    > "FightOnSCTrojan" wrote in message
    > news:[email protected]..
    > > In another words, you want to create a VI in which the input is 2
    > > strings (i.e. AB) and the output is the converted array bits (e.g.
    > > 1010101010101010)?
    >
    >

  • 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

Maybe you are looking for

  • Saving Dunning Letters as PDF

    Hi, I am running the dunning wizard but I don't want to print the dunning letters at the end of the wizard.  Instead, I want to save them on my PC as PDF so that I can send them through e-mail later on.  How can I do this please?  How can I save the

  • Outlook Connector 6.0 and Administrator rights

    Hi all! We want to use the Sun Java System Connector for Microsoft Outlook 6.0 with Windows 2000 with Outlook XP. To install the generated exe file as an user, he needs admin right. Afterwards we take the administrator rights from the user away. Run

  • What is Time-Machine doing with all that space?!!!

    When I installed Leopard, I had about 750 GB of data on internal hard drives. I set up Time-Machine to back-up to a 1.5 TB external hard drive. I was certain that this was enough space to keep the program happy for a very long time. But now, only two

  • Terminal and Widget Problems

    I am running into an unusual problem with my computer. I used Terminal to allow my widgets to go to the desktop (witch did not work), but when I typed in the command it added the plus and arrow symbol (the same as when you go to widgets on your mac)

  • Write once run anywhere

    Is it possible to write one application that can run on Notebook, Palm OS and Win CE PDAs ? If can, how? What tools and APIs do I need? How about the jvm? If can't, why? I need to know it asap, waiting for your helps, thanks.