Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem from function ibrd()! Please help me!

 I load the gpib-32.dll for my api first , then
 
ibwrt(...command_1....)
temp1=ibrd(...)
 
ibwrt(...command_2...)
temp2=ibrd(...)
 
Then I found the temp1 changed and will be same value as temp2! 
But the two command are diffrent, and first time I have got already the correct return value for temp1. But after temp2=ibrd(...), temp1 will be changed same as temp2.
Why? How can I solve this problem?Smiley Sad
Thanks very much!:womansad:
 
0 Kudos
Message 1 of 3
(3,709 Views)
I'm not exactly sure of what you're seeing...You realize that temp1 and temp2 are only going to be the IBSTA values from the read, correct?  The return from ibrd() isn't actual string data.  So you will get some decimal number that indicates the success or failure of your read.  Of course, temp1 shouldn't be affected as a variable during your 2nd ibrd unless you're passing a pointer to it in to the ibrd function.  The ibrd function does take a char* parameter...
 
If you could flesh out your code a bit more and describe your problem with more detail (what values are you seeing for temp1 & temp2 and why do you think they're wrong?)  I'm sure we could pinpoint your issue.
 
Scott B.
GPIB Software

Message Edited by ScottieB on 04-18-2006 10:38 AM

0 Kudos
Message 2 of 3
(3,699 Views)
Hi,

temp1 and temp2 are probably references to the same variable.

Just define these variables as independant memory storage ( by value:
two dim, two malloc or two new statements) ...

Regards,
FG

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