ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

visual basic and serial

Solved!
Go to solution

status = viOpenDefaultRM(defaultRM)
status = viStatusDesc(defaultRM, status, response)
readingslist.AddItem "viOpenDefaultRM " & Hex(status) & response

 

'status = viOpen(defaultRM, "GPIB0::6::INSTR", 0, 0, vinstr)' working good with gpib
status = viOpen(defaultRM, "ASLR1::INSTR", 0, 0, vinstr) ' not working when using serial

Could some help me understanding why i am not able to open the COM1 port using the above visa command in visual basic. I am not having any issue when using the GPIB0, i will need to use both communication type.

 

I have visa32 and visatype loaded in the modules.

 

 

Joce

0 Kudos
Message 1 of 6
(5,803 Views)

Upon trying to open resource, i am getting the below error message. ASLR1 works fine when using the MAX application but not able to access the resource in visual basic:

 

"Insufficient location information or the device or resource is not present in the system."

 

Joce

0 Kudos
Message 2 of 6
(5,785 Views)
One thing you could do is run NI-SPY and then access the instrument again with NI-MAX and see what VISA calls it is making.
Message 3 of 6
(5,769 Views)

hello, i have run NI spy, and found out the call was kind of the same, at the exception that it uses mode 4 instead of 0. either case when i put 4, it still does not give me a "0" status" in visual basic

 

below is the call when using ni.spy 

1.  viOpenDefaultRM (0x0112ADA0)
Process ID: 0x00000854         Thread ID: 0x000002D4
Start Time: 07:15:41.282       Call Duration 00:00:00.046
Status: 0 (VI_SUCCESS)
2.  viOpen (0x0112ADA0, "ASRL1::INSTR", 4, 0, 0x01139F08)
Process ID: 0x00000854         Thread ID: 0x000002D4
Start Time: 07:15:41.563       Call Duration 00:00:00.062
Status: 0 (VI_SUCCESS)

 

0 Kudos
Message 4 of 6
(5,765 Views)

What is strange is when i run the NI spy and the code in visual basic, it return "0x00000000" for vi in the identifier instead of a number. my vi variable is declared as Dim vinstr As Long

 

why is this happenning?,

 

2.  viStatusDesc (0x105828A8, 0, "Operation completed successfully.")
Process ID: 0x00000F5C         Thread ID: 0x00000B7C
Start Time: 07:23:39.291       Call Duration 00:00:00.000
Status: 0 (VI_SUCCESS)
> 3.  viOpen (0x105828A8, "ASLR1::INSTR", 4, 0, 0x00000000)
> Process ID: 0x00000F5C         Thread ID: 0x00000B7C
> Start Time: 07:23:39.291       Call Duration 00:00:00.000
> Status: 0xBFFF0011 (VI_ERROR_RSRC_NFOUND)

Joce

0 Kudos
Message 5 of 6
(5,761 Views)
Solution
Accepted by topic author joce

Well, i feel so stupid, i missed spelled " ASRL1" by "ASLR1"

 

it is working now.

 

Thanks for your help

 

Joce

0 Kudos
Message 6 of 6
(5,758 Views)