05-15-2009 12:21 PM
Hello..
I am using a 4 Hygroclip-2 (Rotronic) RH & T sensor each connected to computer as a USB device. The issue is there r 4 parameters to identify a port as per the instrument driver i have. (1) Port: 2 (i.e. USB) (2) Post address: 0/1/2/3.... (3) Device ID: 32 (default) (4) Device Address: 99 (default)
Only Post address is the parameter I can change and using that I am identifying each sensor. If inbetween I am plugging out a sensor the VI reasigns post address to other sensors starting from 0, 1, 2 and so on. Is there any way I can fix the port address irrecpective of wether a device is pluged in or not.
Thanks.
Solved! Go to Solution.
05-18-2009 03:45 AM
The Sub VI to read a single Hygroclip sensor is attached.
06-04-2009 07:31 AM
Hello Aidy,
I was asked to help out since there has been no reply to your post.
It seems to me that there is logic in your code to cover for what you are trying to avoid.
Am I right to assume that the Hydroclip>Available property node checks on whether the resource you have suggested is available or not? It seems that when the resource is not there you have a "False" case you can utilize in order to add code and decision making elements to manipulate your controls.
The first thing I would do would be to set a default value for my control; for example go to the "PortAddress" control, set its value to the desired one (eg. 2), and then right-click on the control to go to Data Operations> Make Current Value Default. This will mean that even if your code says "reinitialize to default", this will remain at "2". Otherwise you can use a property node to reassign the control to a different port. You should right-click on the control to go to Create>Property Node>Value, right-click on the property node and "Change All To Write", and then wire in a constant with the alternative selection of Address you would choose in case the one you want to access is not available.
I hope that I have understood what you are trying to do and helped with the above, however do let me know if it was something different that I missed and I will do my best to help you out further.
Kind Regards,
Michael S.
Applications Engineer
NI UK & Ireland
06-04-2009 09:04 AM
Hello Michael
Many thanks for you suggestion.
I have already tried to do what you said in the post.
I have attached 3 snapshots of the front panel of my program. in the first figure USB_0 all the 3 Hygroclip sensors are connected. See the serial number of sensors and Port address! It automatically assigns port address to the sensor with lowest serial number!!!
In figure USB_1.........i removed the sensor previoulsy at port address 0. Now the program reassigns port address as shown in the figure.
Again in figure USB_2 the same thing happens.
I want to fix the port address i.e. the physical location of USB. say for the USB port on the left is 1, on the right is 2, on the back of computer is 3 and so on!! but in the present case it is variable and depends upon the hardware attached to it!
Aidy
06-04-2009 10:50 AM
Hello Aidy,
I had a quick look at the sensor you are using and it seems like you select the connectivity yourself. Am I right?
In that case, what sort of USB device are you using? A model number would be ideal!
There are settings from within Windows that should be keeping the ports assigned to fixed addresses but it really depends on what you are connecting up it may seem.
I am hoping to be able to help you better with this information if you can provide it.
Kind Regards,
Michael S.
Applications Engineer
NI UK & Ireland
06-04-2009 11:36 AM
Hello Michael,
I am using a Hygroclip-2 (HC-2) temperature and humidity sensor from Rotronic. It is based on Airchip 3000 tech.
Please see the URL:
http://www.rotronic-humidity.com/_upload/gen_downloads/HumidityNews_EN_%2021.04.2008.pdf
Yes, I am selecting the connectivity.....by defining the port address.
Say for if the VI is running and I unplug one of the sensor......the VI will reassign port address to other sensors plugged in.....starting from 0 to the device having lowest serial number......1 having higher and so on.
Aidy
06-04-2009 12:18 PM
Hello Aidy,
I do apologise, I think I misunderstood the sensor's manual; it seemed to me that it only provided with UART connectivity and you had to select a device to interface with your system.
But from what you describe, the same company provided you with the USB interface as well.
Let me investigate into this a little further and I will get back to you as soon as I can.
Kind Regards,
Michael S.
Applications Engineer
NI UK & Ireland
06-04-2009 12:29 PM
Hello Michael,
I am sorry for not providing exact info. Actually, the company provided me with a HC-2 sensor with a connecting cable......to connect with the sensor at one end and to connect with the computer via USB at other end. Also, I got a instrument driver (Labview VI) (which i attached in my 2nd post) from the same company.
I am playing with the driver VI and made a VI that can talk to 2 or more such type of sensors at the same time as I have 7 of them for my application and I have plans to use them simultaneously at different locations in my instrument setup.
Thanks
Aidy
06-04-2009 01:09 PM
Aidy
You've just run into the largest problem with USB plug-and-pray (oops, plug-and-play) drivers. The OS assigns the devices dynamically. There is no way to reserve or preserve the resource for a device. So, you will need some code to keep track of when the resources go stale and when new resources become available.
06-22-2009 08:27 AM
Hello Jeff, Michael,
Hygroclip USB is a plug and play device.......so when you plug it in..it will give you the temperature and humididy readings through the software (Labview code or Rotronic-Hygroclip software).
If there is any procedure or program or code to identify to which port I am plugging in the device my prblem is solved! but i am not sure about that particular code!
If you have any idea or other options please let me know.
Thanks
Aditya