Hello every one
I am trying to add X-axis data and Y-axis data. And want to store them in the csv file with new column. I started from "ProcessDataItems(tLogRecord *pRecord)" under acquire.c file. I am using IQMath library.
ProcessDataItems(tLogRecord *pRecord)
{
_iq accelx, accely, rval;
//long lAccel;
unsigned int r;
unsigned int uIdx;
unsigned int uItemIdx = 0;
unsigned long ulSelectedMask = g_pConfigState->usSelectedMask;
//
// Save the time stamp that was saved when the ADC data was acquired.
// Also save into the record the bit mask of the selected data items.
//
pRecord->ulSeconds = g_ulTimeStamp[0];
pRecord->usSubseconds = (unsigned short)g_ulTimeStamp[1];
pRecord->usItemMask = (unsigned short)ulSelectedMask;
..................
............................
//
// Process the accelerometers. These will be processed and stored in
// units of 1/100 g.
//
for(uIdx = LOG_ITEM_ACCELX; uIdx <= LOG_ITEM_ACCELZ; uIdx++)
{
//
// Check to see if this item should be logged
//
if((1 << uIdx) & ulSelectedMask)
{
//long lAccel;
lAccel = (((long)g_ulADCData[uIdx] - 2047L) * 1000L) / 4095L;
pRecord->sItems[uItemIdx++] = (short)lAccel;
}
if (uIdx ==LOG_ITEM_ACCELX)
{
accelx = lAccel;
}
if (uIdx ==LOG_ITEM_ACCELY)
{
accely = lAccel;
}
}
rval = _IQmag(accelx,accely);
pRecord->sItems[uItemIdx++] = (short)rval;
...............................................
After executing the program, I got the following output and which is not accurate.
| AccelX(.01g) | AccelY(.01g) | AccelZ(.01g) |
| 2 | 17476 | -3 |
| 0 | 17476 | -3 |
| 1 | 17476 | -4 |
| 1 | 17476 | -3 |
| 2 | 17476 | -3 |
| 1 | 17476 | -4 |
| -1 | 17476 | -2 |
| 0 | 17476 | -5 |
| 0 | 17476 | -5 |
| 1 | 17476 | -4 |
Can anyone suggest me for this problem.
Thanks in advance
Rupok