I'm using Visual c++ 7.0 write a program to acquire analog data from PCI 6255. I 'm using DAQmx 8.3.
Application:
1. A DC motor controled by DIO of PCI 6255. Port0 line1 and line2, 0 0 stop, 0 1 move forward, 1 0 move backward
2. An encoder is connected to PFI0 of PCI 6255 as external clock for A/D samples.
3. Set PCI 6255 do A/D using external clock ,MAX 10,000 samples per second, each sample contains AI0~AI20
4. Register every 2 samples per channel event to read data. I have to use every 2 samples (2 external pulse from encoder to sync a PCI 6533 DIO)
Flow of program:
All this functions are in one separated thread.
1. Start motor, output from DIO
2. Start Analog voltage acquisition, when motor is moving
3. Stop acquisition and stop motor when reach specified distance
4. Send a message to main window, to display data
Problem:
1. When motor move samll distance, it works well. but when move long distance or and more channels to each sample, it seems event is not fired every 2 samples. it is fired only a few times in the whole movement.
2. I checked signal from encoder, it is about 4.5~5.0 V, so it's not external clock signal problem.
3. I tried to override default input buffer, but it doesn't work.
Please see attachment for my source code. I have worked 2 days and haven't made any progress. I will appreciate any suggestions and help.
Laurence