Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read data from USB port (COM Port) at the same time of acquiring data using TTL line (PFI-1)

I am using PCI6250 card and Measurement Studio (VC++).  I used a data acquisition routines (from one of the NI examples) to continuously acquire data (6 channels) triggered off the TTL line (PFI-1).  The twist is that I need to read data from the USB port every time that the TTL line triggers.  This data is the independent distance wheel.   So after each trigger, I read the USB data in the ::OnEvent routine.  This works as long as the data acquisition is slow.  However in the case of fast data acquisition, I do not get the return back (in ::onEvent) until the data acquisiton is done (which sometimes after a many triggers) and the USB data (distance wheel) are not correct.  Is there anyway we can incorporate USB port reading into the data acquistion thread?

 

Thank you,

Yajai

0 Kudos
Message 1 of 6
(7,221 Views)

DrObb,

 

It is not likely you will be able to synchronize your USB port readings with your DAQ readings if you are sampling at a fast rate. It sounds like you plan is to trigger the USB port reading through software. Are you just reading a signal that is already waiting on the port? Or do you need to tell the USB device to send the signal first? It is generally not recommended to use USB device if you want to do any kind of synchronization. Additionally, you will run into further complications when pairing that with software timing (which is very inaccurate unless you are using a realtime system). What sort of readings are you trying to synchronize?

 

 

National Instruments
Message 2 of 6
(7,203 Views)

Data from the USB port is waiting to be read (it came from a separate source - it is a counter of the distance wheel).  I need to read this data whenever the data acquisition occurs so I know the correct distance associating with the waveform data.  So would it be possible to read digital I/O port on the NI card either with a counter or a PIO line (synchronize with data acquisition)?  If this is possible, we can wire from the port to digital I/O line.

 

Thanks,

Yajai 

 

 

 

0 Kudos
Message 3 of 6
(7,196 Views)

Can you please clarify what USB device you are using?

 

Best regards,

 

Ali M

Applications Engineer

National Instruments

www.ni.com/support

0 Kudos
Message 4 of 6
(7,160 Views)

It is QSB device from US Digital (www.usdigital.com)

 

Thanks,

Yajai

0 Kudos
Message 5 of 6
(7,157 Views)

DrObb,

 

Can you use the counters on the 6250 for your distance encoder? If you are taking the measurements on the same card it will be much much easier to synchronize the two measurements.

National Instruments
0 Kudos
Message 6 of 6
(7,129 Views)