LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to ask the I2C device alias name from the MAX

Solved!
Go to solution

 


@Jick wrote:

Yes, but I have to automatically recognize which I2C device is connected and write its unique alias name into the device reference in input node.

 

One solution is to use VISA Find Resource vi, parse the serial number out from the string array and use that serial number as an alias name in MAX. But how can I convert a serial number string to the device reference in type? I can't wire it directly because it gives me an error when I run the VI.


 

You could just use Find Resource twice. For example, this is what shows up on my system:

 

You could search the first array and then index out the appropriate element from the second one.

 

Message 11 of 14
(1,326 Views)

Ok, I'll try that when I am back at office.

 

If I write the alias name to device reference in input node as a string it will give me an error. I hope your trick works!

 

BR,

Jick

0 Kudos
Message 12 of 14
(1,317 Views)

@Jick wrote:

 

If I write the alias name to device reference in input node as a string it will give me an error. I hope your trick works!

 


Are you sure you will get an error?  I don't know about the 8451 drivers, but with the DAQmx drivers, you can write a string to the Device Name input and it will cause a red coercion dot, but it won't give an error, and it will work.  Try it,

- tbob

Inventor of the WORM Global
Message 13 of 14
(1,302 Views)
Solution
Accepted by topic author Jick

Ok. I don't know what was wrong last time when I got an error when wiring a string to reference in input node but now it seems to accept it.

 

In LV 8.0 the solution is to wire 2 into the search mode input. That is how I get the connected device's alias from the find list string array. And the correct alias is always at index 0 in the string array.

 

BR,

Jick

0 Kudos
Message 14 of 14
(1,274 Views)