int Eventmode=1;
char *ChanStr="AI0:7";
int DaqEvent=0;
int DaqTrigVal0=m_BufferSize;
int DaqTrigVal1=0;//m_BufferSize/2;
int TrigSkipCount=0;
int preTrigScans=0;
int postTrigScans=0;
int Message=1;
short m_DeviceNo=1;
short m_Timeout=180;
double m_DaqSampleRate=256000.0;
short m_ChannelVector[8]={0,1,2,3,4,5,6,7};
short m_GainVector[8]={1,1,1,1,1,1,1,1};
short m_BufferSize=256000*120;
short m_pBuffer[2*m_BufferSize];
short m_pHalfBuffer[m_BufferSize];
short ChannelNumber=8;
void CDataReader::StartReading()
{
m_DaqStatus = Timeout_Config(m_DeviceNo, m_Timeout);
m_DaqRetVal = NIDAQErrorHandler(m_DaqStatus, "Timeout_Config",m_IgnoreWarnmsg);
//m_DaqStatus=Config_DAQ_Event_Message (m_DeviceNo, Eventmode, ChanStr,DaqEvent, DaqTrigVal0,DaqTrigVal1, TrigSkipCount, preTrigScans, postTrigScans, 0,Message, (unsigned long)CallBack);
m_DaqStatus=Config_DAQ_Event_Message(m_DeviceNo,
(i16) 1, // add message
ChanStr, // channel string
(i16) 1,// daq event type
(i32) m_BufferSize/2,// trig val 0
(i32) 0,// trig val 1
(u32) 0,// trigSkipCount
(u32) 0,// preTrigScans
(u32) 0,// postTrigScans
NULL, // handle of window
(i16)WM_NIDAQ_MSG, // message to post
(u32)CallBack);
m_DaqRetVal = NIDAQErrorHandler(m_DaqStatus, "Config_DAQ_Event_Message",m_IgnoreWarnmsg);
m_DaqStatus = DAQ_Rate(m_DaqSampleRate, m_NumDaqUnits, &m_DaqSampleTimebase, &m_DaqSampleInterval);
m_DaqRetVal = NIDAQErrorHandler(m_DaqStatus, "DAQ_Rate",m_IgnoreWarnmsg);
m_DaqStatus = DAQ_DB_Config(m_DeviceNo, m_DBmodeON);
m_DaqRetVal = NIDAQErrorHandler(m_DaqStatus, "DAQ_DB_Config",m_IgnoreWarnmsg);
m_DaqStatus = SCAN_Setup (m_DeviceNo,ChannelNumber, m_ChannelVector,m_GainVector);
m_DaqRetVal = NIDAQErrorHandler(m_DaqStatus, "SCAN_Setup", m_IgnoreWarnmsg);
m_DaqStatus = SCAN_Start (m_DeviceNo, m_pBuffer,m_BufferSize,m_DaqSampleTimebase, m_DaqSampleInterval , m_DaqScanTimebase,m_DaqScanTimeInterval);
m_DaqRetVal = NIDAQErrorHandler(m_DaqStatus, "SCAN_Start",m_IgnoreWarnmsg);
}
void CallBack (int handle, int msg, unsigned wParam, unsigned long lParam)
{
//here i want to transfer data from double buffer
short daqStopped=0;
unsigned long retrieved;
if(m_DaqStatus = DAQ_DB_HalfReady(m_DeviceNo, &m_DaqHalfReady, &m_DaqStopFlag)) != 0)
m_DaqRetVal = NIDAQErrorHandler(m_DaqStatus, "DAQ_DB_HalfReady", m_IgnoreWarnmsg);
if (m_DaqHalfReady == 1)
{
//Transfer the data Using Daq_DB_Transfer
}
}
Description:
I m getting data in doublebuffer from 8 channels.I want to attach CallBack with the event When the half ready is on.
When I give parameter in Scan_SetUp the channel number then it work correctly and the CallBack is properly called.
I want to call Scan_SetUp for 8 channels then the callback is not properly called when halfready is on.
when i give totalnumber of channels the it throws exception that is also attached with the problem.
so pleaze tell when then Half ready is on then Callback automatically should be invoked.
The above is code sample.
Detail:
Actally I have Daq PCI-6025E Dad driver version6.9.2.
it has 8 channels.i want to get data from the channels with out loss of data.
So i use Scan_setup and SCAN_START api's for this puroose.
I want data of one minute time span from each cahnnel.
I donot want to use coninously looping to chaeck wheather the data of one minute is available or not from 8 channels.
For the purpose I use Config_Daq_Even_Message.
The Event i attached is "1" so when all channels have been scanned for one minute data then callback should be invoked.
But it doesnot happed after the one minute of time span.It is inoved after two minute of duration.But I want to invoke it after one
minute duration for 8 channels.
So please tell Thanks ajmal
Lead Data Scientist