09-23-2021 07:35 PM - edited 09-23-2021 07:38 PM
Hello!!!!
I'm South Korean
Please understand that I am not good at English.
I am currently implementing a GPIB communication program with controller and noncontroller.
The problem is, when the controller is ibrd
<Source Code 1>
Int GPIB:: recv_data (string & v)
{
vector_char bufv(BUFSIZ, 0);
ibrd(device_, &bufv[0], bufv.size());
v = &bufv[0];
return ibsta & ERR ? -1:0;
}
If I use a large size like above, the speed of ibrd is too slow.
However, It will improve ibrd speed if I create it as below.
<Source Code 2>
Int GPIB:: recv_data (string & v, uint32_t data_size)
{
vector_char bufv(BUFSIZ, 0);
ibrd (device_, &bufv[0], data size);
v = &bufv[0];
return ibsta & ERR ? -1:0;
}
Is there any way to improve speed using the same method as Source Code 1?
The size of the bufv to be read is variable.
Help me
09-27-2021 03:12 PM
What instrument are you using? How much data are you reading? How long does it take?
AFAIK ibrd() speed should not be dependent on buffer size.
Note that your function require you to wait for ibsta & ERR calls to instrument. These will be instrument and timeout dependent and may take longer than your ibrd() depending on what conditions you set in the instrument status registers.
Craig