The code sample below shows a sample readscl() function that reads out 32 channels of a scaler whose object is stored in pScaler.
readscl (UINT32* buffer,int numscalers) { ... pScaler->ReadAllChannels(buffer); buffer+= 32; // The buffer pointer must advance. ...
Alternatively, a channel at a time:
readscl (UINT32* buffer,int numscalers) { ... for(int i = 0; i < 32; i++) { *buffer++ = pScaler->ReadChannel(i); } ...
These modes are described in sis3820InputModes.
In either event, it is important not to use CSIS3820::ReadChannel or CSIS3820::ReadAllChannels as these functions read the incrementing counter registers rather than the latched shadow registers. The correct functions to call to read the shadow registers are either CSIS3820::ReadLatchedChannel or CSIS3820::ReadAllLatchedChannels. To force a latch, the CSIS3820::Latch function can be called. If you want to latch and read all channels, the convenience function CSIS3820::LatchAndRead is available.