Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

how to viwrite() and viread() commands in vb?

we use VISA32.dll and rsfsh_32.dll communication with FSH
after excutting the following program:
........
     status = rsfsh_setCenterFrequency(g_hrsfsh, freqcenter)
      Call ErrHan(status)
    status = rsfsh_setFrequencySpan(g_hrsfsh, freqspan) 
    Call ErrHan(status)
.......
 
we can get sequene codes with Ni SPY:
...
24.  viQueryf (ASRL4 (0x01E8C7B8), "%s", "%ld")

0 (VI_SUCCESS)
 
25.  Formatted viWrite (ASRL4 (0x01E8C7B8), "SET", 3, 3)
0 (VI_SUCCESS)
 
26.  Formatted viRead (ASRL4 (0x01E8C7B8), "0.", 4000, 2)
0 (VI_SUCCESS)
 
27.  viQueryf (ASRL4 (0x01E8C7B8), "%s", "%ld")
0 (VI_SUCCESS)
 
28.  Formatted viWrite (ASRL4 (0x01E8C7B8), "FREQ,930000000.000000", 21, 21)
0 (VI_SUCCESS)
 
29.  Formatted viRead (ASRL4 (0x01E8C7B8), "0.", 4000, 2)
0 (VI_SUCCESS)
 
30.  viQueryf (ASRL4 (0x01E8C7B8), "%s", "%ld")
0 (VI_SUCCESS)
 
31.  Formatted viWrite (ASRL4 (0x01E8C7B8), "SET", 3, 3)
0 (VI_SUCCESS)
 
32.  Formatted viRead (ASRL4 (0x01E8C7B8), "0.", 4000, 2)
0 (VI_SUCCESS)
 
33.  viQueryf (ASRL4 (0x01E8C7B8), "%s", "%ld")
0 (VI_SUCCESS)
 
34.  Formatted viWrite (ASRL4 (0x01E8C7B8), "SPAN,60000000.000000", 20, 20)
0 (VI_SUCCESS)
 
35.  Formatted viRead (ASRL4 (0x01E8C7B8), "0.", 4000, 2)
0 (VI_SUCCESS)
...
 
all is ok!
 
but if we want to rewrite the program with VB, How can we do ?
 
there is not viQueryf function  in VB. ViQueryf is only C function.
 
Could somebody help us? Could you give us some instance program?
 
TIA!
 
 
 
 
 
0 Kudos
Message 1 of 4
(5,523 Views)

I think you need to use commands like "~~" and "!!"...

0 Kudos
Message 2 of 4
(4,705 Views)

 


@NA1 wrote:

I think you need to use commands like "~~" and "!!"...


 

 

 

 

For original question: viQueryf is just a combination of viPrintf and viScanf. Unfortunately, those functions are also not supported in VB. What you have to do is to change the code so that you use viWrite and viRead and do your formatting and parsing separately using standard VB functions.

0 Kudos
Message 3 of 4
(4,687 Views)
0 Kudos
Message 4 of 4
(4,652 Views)