03-28-2013 06:58 AM
Hi,
I have a GPIB controlled instrument that has no driver, Martel 2001.
I have a USB-to-GPIB controller.
The Martel is on GPIB0::4::INSTR, according to MAX.
At a very basis level it need to do request it type, *idn?.
Also to control On/Off (OPER/STBY), set it to 10mV (out 10 mV)
I have tried to get an understanding from the supplied example, with no joy, hence this request.
We normaly used RS232, so I am OK with the commands, it is just how to use GPIB.
Thanks
Simon
03-28-2013 09:09 AM
Hi,
I think I can now answer this, see if this is correct?
Use ibdev to define the GPIB port and device number (4 in the case below) you wish to talk to.
Ibwrt is used to write the command to the device as set in ibdev.
Ibrd is used to read, if required, from the device as set in ibdev.
The example I found is using ThreadIbsta for error trapping, what is this, is that correct?
Thanks
Simon
03-28-2013 09:31 AM
Hi,
Sorry for thinking here but you are the only people I can ask, thanks.
All is good, able to send and read *idn? to two instruments and get the correct response, all hard coded.
Problem is if I switch off one of then the code crashes.
Any suggestions as how to get over this and trap it before it crashes?
Thanks
Simon
04-03-2013 03:31 AM
Hi Simon, thanks for posting. I have a couple of questions:
Are you able to narrow down the area or line of code which is causing CVI or the code to crash?
Is there an error that is reported by either CVI or your operating system?
If you could post the code that you have so far, it may give us a better idea of what could be happening in your code.
04-03-2013 04:41 AM
Hi,
Thanks for your input, always appreciated.
This is true of any device, it is a method to error trap and to handle it correctly to allow release to others.
When the dll is built as released, run from TestStand and the Martel if powered off it will continue, which is not what I want.
Then I ran the test again with the Martel on and all is good.
Switched the Martel off and now it will just read the last value from my DMM, new problem, just noticed.
Build the CVI project a Debug and Switched the Martel off.
NON-FATAL RUN-TIME ERROR: "c:\...\Voltage_Supply_and_Read.c", line 27, col 5, thread id 0x0000172C: Function ibclr: (iberr == 6 [0x6]).
C file, Voltage_Supply_and_Read.c, attached.
Second problem, just now, how do we ensure we have the current reading from the DMM?
Thanks
Simon
04-03-2013 06:57 PM
Don't use ibclr(Device_2001). Instead, use ibln(Device_2001, 4, NO_SAD, &dev_ready) after ibdev(....) and check the value of dev_ready. If dev_ready is 1, then your equipment is ready for communication. Also, I will try longer time-out setting, T3s or T10s, in the ibdev(....) function. Some equipment just doesn't like ibclr(...) to begin with nor 1 sec time-out.
04-04-2013 03:52 AM
Hi,
Thanks for your input.
I did as you suggested and used the returned value to control the flow based on the value, basic stuff I know.
Thanks again
As a note, regardless of the error handling you will always, I found, get the NON-FATAL RUN-TIME ERROR when in debug mode if the equipment is off.
Thanks
Simon
04-08-2013 12:37 PM
Thanks again dcl9000.
Hi Simon, I'm glad you have managed to progress,
Just to make sure, do you still recieve the non-fatal run-time error? If so, does it report a different code?