Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5566

Disturbed GPIB control from AP Basic / Visual Basic

$
0
0

Hi everyone,

 

I am trying to control a GPIB Instrument by sending simple control-strings from the audio measurement software AP2700 by Audio Precision. I have already tested the GPIB (PCIe) interface and the instrument by controlling the instrument via the GPIB Interactive Control and NI-MAX ("Communicate with Instrument"), both delivered with the latetest NI-488.2 package. Everything works fine and with the NI-I/O-Trace tool i can inspect the GPIB traffic:

NI-IO-Trace_1.png

Now I am trying to do the same from AP2700 which deliveres a macro editor supporting AP Basic, a language which is mostly compatible with Visual Basic for Applications (VBA). I have included the module files "vbib-32.bas" and "niglobals.bas" to my macro and wrote the following lines of code:

'#uses "C:\modules\niglobal.bas"
'#uses "C:\modules\vbib-32.bas"

Sub Main
dev% = ildev 1, 14, 0, 13, 1, 0
ilclr dev%
buf$ = "Some_cmd_string"
ibwrt dev%, buf$
ibonl dev%, 0
End Sub

This Sequence should initialize the connection from the board (ID 1) to the instrument (addr. 14), clear the device, write a string and set the connection to "offline" again. Notice that these are the same lines, which were used by NI-MAX when communicating to the instrument (screenshot above). With the I/O-Trace tool I could again inspect the GPIO traffic, but strangely in the line with the ibwrt command the buffer contains completely different characters. The character count is ok, but the content is just rubbish. In addition the content seems to be not static and changes sometimes on executing the code repeatedly.

The screenshot below shows how the string "Some_cmd_string" results in "..%......jVg..." (I have noticed that very much "."  are contained in the disturbed strings).

NI-IO-Trace_2.png

Has anybody suggestions on what could go wrong here and/or how I could fix this?

Thanks a lot!

 

jogrue

 

_____________________________________________________

EDIT:

 

I am so sorry for disrespecting one of the first rules on forums: a proper research befor posting.

Right after the first post I found my solution in form of two advanced .bas module-files for the use with AP Basic, provided by AP itself. I should have seen them already much earlier, as they can be found by searching for "ap2700 gpib" on google. For anybody may encountering the same problem, here is the link:

 

Using AP Basic to Control GPIB Devices - Audio Precision

 

Mea culpa - but believe me, I have already spent some frustrating hours on my problem before writing this post 😄

 

jogrue


Viewing all articles
Browse latest Browse all 5566

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>