I have a problem with the pl1000 serie 1216.
When I log for a long time. The first ~600000 samples are ok but from then I See a shift in the sample data.
I have a IO panel with some io set to vcc and some ground. Those i\o are connecten to a power supply for a duration test. So the values there will not change.
As you can see in the part below. We see some data movement channel shifting. This is a part of log file 361. half way. The previous log files all had the pattern of the first 13 rows. But here we see a shift.
const int cMaxIOArray = 16;
const int cLogBufferSize = 0x7FF;
const int cReadBufferSize = 256;
short cAllChannels[cMaxIOArray] = {PL1000_CHANNEL_1,PL1000_CHANNEL_2,
PL1000_CHANNEL_3,PL1000_CHANNEL_4,
PL1000_CHANNEL_5,PL1000_CHANNEL_6,
PL1000_CHANNEL_7,PL1000_CHANNEL_8,
PL1000_CHANNEL_9,PL1000_CHANNEL_10,
PL1000_CHANNEL_11,PL1000_CHANNEL_12,
PL1000_CHANNEL_13,PL1000_CHANNEL_14,
PL1000_CHANNEL_15,PL1000_CHANNEL_16};
clsLogData mLogBuffer[cLogBufferSize];
unsigned short mIODataInterface[cMaxIOArray*cReadBufferSize];//[cMaxIOArray];
clsLogData mDataToProcess[cReadBufferSize];
int mDataToProcessCount;
mStatus = pl1000OpenUnit(&mPicoHandle);
mStatus = pl1000MaxValue(mPicoHandle,&lMaxValue);
unsigned long usForBlock = (cMaxIOArray* cReadBufferSize *50000) ; // ArraySize * 50 ms. sampeling time
// set sample mode
mStatus = pl1000SetInterval(mPicoHandle, &usForBlock, cMaxIOArray* cReadBufferSize, cAllChannels, cMaxIOArray);
// start the module;
mStatus = pl1000Run(mPicoHandle,cMaxIOArray * cReadBufferSize,BM_STREAM);
unsigned long lSize = 1 * cReadBufferSize;//cMaxIOArray;
unsigned short lOverflow = 0;
unsigned long lTriggerIndex = 0;
static int lCounter = 0;
static int lTotalSize = 0;
bool lDataToProcess = false;
unsigned long lRetval = pl1000GetValues(mPicoHandle,mIODataInterface,&lSize,&lOverflow,&lTriggerIndex);
Sleep(100);
When I look in the debugger in the mIODataInterface I see the channel shifting. But the lRetval == PICO_OK.
I’m probably doing something wrong. I do add a time stamp when I add the data to my own logger. So in the example above every set with the same time stamp were recived in 1 call to getvalues.
The first set that went wrong :
2011-12-13 03:12:32:477 , 3445, 3467, 4, 2, 3452, 3, 1, 4, 3464, 3, 1, 1, 2, 1, 3467, 3
2011-12-13 03:12:32:477 , 3445, 3467, 4, 2, 3452, 3, 0, 2, 3464, 3, 3, 1, 1, 1, 3468, 3458
2011-12-13 03:12:32:477 , 3481, 3, 2, 3448, 3, 2, 1, 3473, 4, 1, 1, 1, 4, 3452, 3, 3458
2011-12-13 03:12:32:477 , 3481, 2, 2, 3447, 3, 2, 2, 3473, 4, 2, 1, 1, 2, 3451, 3, 3459
The first record is OK and after that the problems start. From here on all the time there is a shift in the channels.
My buffer size is cReadBufferSize = 256 * cMaxIOArray = 16
There is room for quit a bit more than just a few samples.
Can some explain me what I do wrong?
And why is it taking more that 600000 samples to get in this error state?