NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Knight of NI
Dennis_Knutson
Posts: 29,306
0 Kudos

Re: USB RS232 type sensor with Labview to read and record data on laptop computer

Look at the examples on serial communication. Before doing any coding, use a terminal emulation program such as Hyperterminal to see whether you can read data. If it's truly a USB-RS23 type of connection, it will show up as a com port in both windows device manager and in MAX (Measurement & Automation Explorer). You will have to have installed NI-VISA in order to see it in MAX and to use it in LabVIEW.

Member
JeanPi
Posts: 3
0 Kudos

Re: USB RS232 type sensor with Labview to read and record data on laptop computer

Mr. Knutson,

Thanks for your reply!

I am checking these samples, but I have a question.

- When I use VISA configure port, how do I define the port where this USB-sensor is plugged-in? does it do it automatically? do I have to install MAX to do all this process?

- When I use the Write-icon and Read-icon to ask the USB-sensor what to do/write/read ... which commands do I use? do I have to contact the vendor and see which commands do I have to use?

 Regards,

JeanPi

Knight of NI
Dennis_Knutson
Posts: 29,306
0 Kudos

Re: USB RS232 type sensor with Labview to read and record data on laptop computer

You have to use the VISA Resource Control to specify the com port. There is no practical way to determine what, if any, instrument is connected to a serial port unless you write the code to do so. You click on the little arrow on the right side of the control to get a list of resources. Finding out which port you need to manually specify is easy. Disconnect the USB connection and see what port disappears in windows device manager or MAX. Plug it back in and see which port reappears.

 

Yes, of course you need to contact the vendor. I would think that the list of commands would be provided in the manual when you bought the sensor.

Member
Fantester
Posts: 27
0 Kudos

Re: USB RS232 type sensor with Labview to read and record data on laptop computer

First you need to setup the drivers for the USB sensor.  Once you do that you can see what COM port will be used for the sensor by looking at Windows Control Panel->System Properties->Hardware (tab)->Device manager.  Expand the PORTS to see what COM port is used for the sensor.  For teh 9150U it should be a CP210x USB to UART Bridge (COMX). 

Once you know the COM port number you can set up a hyperterminal to verify the communication is working and to see how the commands are used.  Once you can communicate with the sensor then you are ready to start building the Labview GUI.

Member
JeanPi
Posts: 3
0 Kudos

Re: USB RS232 type sensor with Labview to read and record data on laptop computer

Mr. Fastener,

Thanks a lot for your thougths!

 

I will install the 9510 software onmy laptop and start the GUI.

I have a question:

 

- Did you use the commands (string to talk with the USB-sensor) from the vendor? I am planning to call them and see if they can help me with this regard.

- After you get the string (read) from the USB-sensor, we can convert it to numbers?

 

All the best.

JeanPi

Member
Fantester
Posts: 27
0 Kudos

Re: USB RS232 type sensor with Labview to read and record data on laptop computer

Yes I used the string commands.

The results you read are different based on what command you send.

You can read a continuous pressure output string or you can read the HEX output.  I had problems reading the data fast so I have not used the sensor unless I only need to sample the data onece per second. 

Member
crappi
Posts: 8
0 Kudos

Re: USB RS232 type sensor with Labview to read and record data on laptop computer

Have you been using the Terminal-commands as strings and sent them to the Visa Write? Any termination character? Any special settings at open visa port?

 

I'm setting the mask to 48, buffer to 10000 and using the normal visa palette vis, but I don't when using visa read the buffer is empty.

Member
rodmangon
Posts: 6
0 Kudos

Re: USB RS232 type sensor with Labview to read and record data on laptop computer

Hi everyone,

 

I was reading the whole conversation and I think you could help me. I am using the same connector (Silicon Labs CP210x USB to UART Bridge) to connect my PC (USB) with a motor controller (RS485), knowing that this connector was provided by the motor controller manufacturer (NANOTEC). This manufacturer also has a software (NANOPRO) to know if this communication and the motor controller (SMCI36 from NANOTEC) are working properly, and it is. 

But the problem appears when I want to program the same in LabView, and I think the problem is this connector, because a few months ago i programmed another motor controller (SMCI33 from NANOTEC) with Labview, using an USB connector to the PC, and there was no problem. That´s why i think now the problem is this connector. 

I tried to use the examples that LabView offer ("Basic Serial Write and Read.vi", "Advanced Serial Write and Read.vi",...). In some of them i didnt get any error, but the information wasn´t sent because the motor didn´t start, and in others, I got a timeout error (-1073807339). Finally i tried to programm it by myself ("Initialisation (SubVI).vi" attached file). With this one, i didnt get any error either, but the information (writing the type of motor, #1:CL_motor_type=1\r ) is not sent. As you can see, the Terminal Character is \r.

I dont know what could be the problem. If you have any idea, please, let me know it. 

Thank you so much.

Knight of NI
Dennis_Knutson
Posts: 29,306

Re: USB RS232 type sensor with Labview to read and record data on laptop computer

The data is certainly being sent though it's not being interpreted correctly by the instrument. Sorry, but I cannot read the manual, I don't speak German so I don't know what should or should not be sent. As in some of the previous posts, you should try to use a terminal emulation program such as Hyperterminal.

 

I also don't understand why you might think the connector/converter is bad. Since the vendor's software works, that means that the hardware is working.

Member
rodmangon
Posts: 6
0 Kudos

Re: USB RS232 type sensor with Labview to read and record data on laptop computer

Thank you Dennis_Knutson for your reply, and sorry for posting everywhere but it is my first time here, and i dont know how this forum works.

I dont think that the problem is the connector (hardware). What I thought was that this wire transform the data, and didn´t give to the motor controller the same data that i sent (with the same format), but i dont know what is the protocol that this wire uses. I checked the Windows Device manager one thousand times, and i think the settings are correct. 

Talking about the Hyperterminal, i just have to send data to the motor controller, not receive them. So, i think it is the same sending data from labview than from hyperterminal, right? Do you have other test in mind?

Thank you so much. Best Regards

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page