Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB; Visual Basic

Hi, I use GPIB to control our device (frequency syntheiszer). Under interative control mode,
I can set the frequency to my device (for example 10MHz). The commonds used are:
:ibdev 0 16 0 13 1 0
ud0: ibwrt "F010000000\n"
 
Then I use the Visual Basic programming language as:
 
Dim Dev As Integer
Call ibdev(0,16,0,13,1,0,Dev%)
Call ibwrt(Dev%,"F010000000\n")
 
The device can still set to 10MHz. However, if I change the frequence to 20MHz as
 
Call ibwrt(Dev%,"F020000000\n")
 
The device are still at 10MHz.
 
Who knows the answer, I really apprecite it.
 
 
 
 
0 Kudos
Message 1 of 3
(3,590 Views)
Hi Dreamhawk
You mention that the command
Call ibwrt(Dev%,"F010000000\n")    works but
Call ibwrt(Dev%,"F020000000\n")    does not.

You also mention
ud0: ibwrt "F010000000\n"    works
does
ud0: ibwrt "F020000000\n"    work?

If not you may try:
ud0: ibwrt "F011000000\n"
and
ud0: ibwrt "F015000000\n"
to move incrementally closer to 20 MHz..


Regards,
John E.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 3
(3,560 Views)
It seems like a string termination problem. 
 
You are using Visual Basic language, not C/C++.  Therefore you can't use "\n" escape sequence to express control characters such as LF (0x0A).  Instead, you must write:
 
Call ibwrt(Dev%,"F010000000" & vbLF)
 
or
Call ibwrt(Dev%,"F010000000" & Chr(10))
0 Kudos
Message 3 of 3
(3,550 Views)