09-24-2015 03:46 AM
Hello,
I´ve been trying to make a little C++ Program.
The Program should wait, until the Device is Ready to Read the value.
Example Code:
Snippet
viOpenDefaultRM(&m_defaultRM);
viOpen(m_defaultRM, "GPIB0::1::INSTR", VI_NULL, m_tmo, &m_Session[x]);
viWrite(m_Session[pad],(ViBuf)"X?", 2, &actual);
/* Wait Until the Value is Ready to Read ( WaitOnEvent ??? ) */
viRead(m_Session[pad], (ViPBuf)strres, 255,&actual);
Have you any Solution for me ?
Thanks.
09-24-2015 08:33 AM - edited 09-24-2015 08:34 AM
@pmb wrote:
Hello,
I´ve been trying to make a little C++ Program.
The Program should wait, until the Device is Ready to Read the value.
Example Code:
Snippet
viOpenDefaultRM(&m_defaultRM);
viOpen(m_defaultRM, "GPIB0::1::INSTR", VI_NULL, m_tmo, &m_Session[x]);
viWrite(m_Session[pad],(ViBuf)"X?", 2, &actual);
/* Wait Until the Value is Ready to Read ( WaitOnEvent ??? ) */
viRead(m_Session[pad], (ViPBuf)strres, 255,&actual);
Have you any Solution for me ?
Thanks.
Any reason why you want to wait ?
Generally with most instruments the response is fairly instantaneous.
You would generally to wait if reading waveforms back from an oscilloscope or something of that nature.
Also, why C++ ?
Rohde-Schwarz has a very explanation about measurement synchronization in chapter 4. http://www.rohde-schwarz.pl/file_7561/1EF62_0E.pdf
09-24-2015 11:39 PM
How does the instrument indicate, that it is ready to be read ? Check the instruments documentation for that.
09-25-2015 06:09 AM - edited 09-25-2015 06:10 AM
Thanks for the replies.
I do it now over the STB register.
This works for me.
Snippet
do { state = viReadSTB(m_Session[pad], &statusByte); Sleep(10); if(state != 0) { return "ERROR"; } } while(statusByte!=16);