LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Rename VISA and XNet Resource Programmatically on RT

Solved!
Go to solution

Here's a long shot.  I have some RT controllers that occasionally will be wiped and the test software is reinstalled on them.  The VISA resources are named things like "PSU_1" and "Chamber_1", and the software just references those names.  But internally it is rare that the PSU_1 isn't ASRL3::INSTR, and it is rare if Chamber_1 isn't ASRL5::INSTR.  So I was hoping that I could look at the VISA naming at the start of my software, and if ASRL3::INSTR isn't named PSU_1, then to name it that.  Is this possible?  For the moment I've just decided to read the aliases and if there is a label PSU_1, then to use that, and if there isn't then use ASRL3::INSTR.  Is there a way to rename VISA resources from a VI running locally on the RT target?

 

Similarly I'm trying to do something with the XNet resources.  I have 4 CAN ports all labeled CAN 1 to CAN 4.  But after a reinstall the naming isn't always in order from the first to the last.  Is there a way to rename XNet resources from a VI running locally on an RT target?  I think I might take the same approach, and just read the device location in the chassis, and then use the first one, even if it is named wrong.

 

Yes I know both of these can be renamed and fixed in MAX, but I want one less step in the setup and configuring of these chassis.  I'd prefer it if the software can just on first run, set them.  Thanks.

0 Kudos
Message 1 of 3
(129 Views)

The System API filters WILL find resources by descriptors AND the System API has a Rename Alias function.  Renaming an Alias will even work if another resource is consuming that Alias string by Resetting the existing resource's Alias to default regardless of the value of property.IsPresent?  (Unlike MAX which forces you to clear the Alias and save first before reassigning the reserved Alias Value.)

 

You can also inspect resource properties for vendor ID, model, SerialNo, cal due date, etc...(any property MAX can see)

 

BONUS: The System API functions read and write data directly to/from xmlhell ( a/k/a the MAX Database)

 

 

I've NEVER tried it in code on an RT target, I think it is supported.   I would prefer sticking configuration inside a host or, if you a headless, the installation should be configuring the RT System.   You dissalow idiots....er, I mean uhm Users, from messing with USB connections right?


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 3
(120 Views)
Solution
Accepted by topic author Hooovahh

Serendipity rides again! 

I just found this old post for another thread

Rename Alias example 

The thread even has this link  Introducing the API about a decade ago. 


"Should be" isn't "Is" -Jay
Message 3 of 3
(83 Views)