Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

la fonction ibrd ne me permet pas de lire la réponse du matériel

Voilà, une partie du code que j'ai tappé en visual basic. La chaine EtatShutter reste désespérément vide. Quel est le problème? De plus une fois que j'ai ouvert le shutter, la commande pour le refermer ne marche plus : il faut que j'éteigne l'appareil puis que je le rallume pour que ça marche. Que dois-je faire?


Call ibdev(0, 4, 0, 13, 0, 10, ud%)
Call ibwrt(ud%, "SHUTTER?" & Chr(10))

TempsDebutBoucle = Timer
Do
DoEvents
TempsCourrant = Timer
Loop Until TempsCourrant - TempsDebutBoucle > 0.1

Call ibrd(ud%, EtatShutter & Chr(13) & Chr(10))
call ibonl(ud%,0)
0 Kudos
Message 1 of 2
(2,743 Views)
Since no one else tried to help, I will volunteer some guesses, but they are only guesses.

Minor issue:
> Call ibwrt(ud%, "SHUTTER?" & Chr(10))
That is perfectly fine Visual Basic code, but for some reason I wonder if you might want to do this:
Call ibwrt(ud%, "SHUTTER?" & Chr(13) & Chr(10))

Major issue, unless I'm being stupid about something:
> Call ibrd(ud%, EtatShutter & Chr(13) & Chr(10))
You have a Visual Basic variable named EtatShutter. Your "&" operators construct a longer string, a temporary value with no name. The unnamed value could be assigned to a variable, or printed, or written. But you aren't doing that. You're trying to read from the device into the unnamed value. Even if the read succeeds, you are doing nothing further with that
unnamed temporary value. Meanwhile, EtatShutter doesn't get its value changed at all.

First try reading into the variable itself:
Call ibrd(ud%, EtatShutter)
After that, check if the last two bytes are Chr(13) and Chr(10), and then extract the rest of the string.

(P.S., if you complain about my English then I will post in Japanese. I could READ most of your French. I hope that my guess can help you.)
0 Kudos
Message 2 of 2
(2,743 Views)