beautypg.com

Daqadcbufferrotate – Measurement Computing TempBook rev.3.0 User Manual

Page 127

background image

TempBook User’s Manual

daqCommand Reference (Enhanced API) 11-3

daqAdcBufferRotate

DLL Function

daqAdcBufferRotate(DaqHandleT handle, PWORD buf, DWORD scanCount, DWORD

chanCount, DWORD retCount);

C

daqAdcBufferRotate(DaqHandleT handle, PWORD buf, DWORD scanCount, DWORD

chanCount, DWORD retCount);

Visual BASIC

VBdaqAdcBufferRotate&(ByVal handle&, buf%(), ByVal scanCount&, ByVal chanCount&,

ByVal retCount&)

Delphi

daqAdcBufferRotate(handle:DaqHandleT; buf:PWORD; scanCount:DWORD;

chanCount:DWORD; retCount:DWORD)

Parameters

handle

Handle to the device for which the ADC transfer buffer is to be rotated

buf

Pointer to the buffer to rotate

scanCount

Total number of scans in the buffer

chanCount

Number of channels in each scan

retCount

Last value returned in the retCount parameter of the daqAdcTransferGetStat function

Returns

DerrNoError

- No error (also, refer to API Error Codes on page 11-39)

See Also

daqAdcTransferGetStat, daqAdcTransferSetBuffer

Program References

None

Used With

All devices

daqAdcBufferRotate

allows you to linearize a circular buffer acquired via a transfer in cycle

mode. This command will organize the circular buffer chronologically. In other words, it will order
the data from oldest-first to newest-last in the buffer. When scans are acquired using
daqAdcBufferTransfer

with a non-zero cycle parameter, the buffer is used as a circular

buffer; once it is full, it is re-used, starting at the beginning of the buffer. Thus, when the
acquisition is complete, the buffer may have been overwritten many times and the last acquired scan
may be any place within the buffer.

For example, during the acquisition of 1000 scans in a buffer that only has room for 60 scans, the
buffer is filled with scans 1 through 60. Then scan 61 overwrites scan 1; scan 62 overwrites scan 2;
and so on until scan 120 overwrites scan 60. At this point, the end of the buffer has been reached
again and so scan 121 is stored at the beginning of the buffer, overwriting scan 61. This process of
overwriting and re-using the buffer continues until all 1000 scans have been acquired. At this point,
the buffer has the following contents:

Buffer

Position

1

2

3

...

39

40

41

42

...

59

59

60

Scan

961

962

963

...

999

1000

941

942

...

958

959

960

In this case, because the total number of scans is not an even multiple of the buffer size, the oldest scan is
not at the beginning of the buffer and the last scan is not at the end of the buffer.
daqAdcBufferRotate

can rearrange the scans into their natural, chronological order:

Buffer

Position

1

2

3

...

39

40

41

42

...

59

59

60

Scan

941

942

943

...

979

980

981

982

...

998

999

1000

If the total number of acquired scans is no greater than the buffer size, then the scans have not overwritten
earlier scans and the buffer is already in chronological order. In this case, daqAdcBufferRotate does
not modify the buffer.

Note: daqAdcBufferRotate only works on unpacked samples.