Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

nihsdio-How to implement variable acquisition size with NI 6561

I have a data source that provides the following lines: clock, 16 data, and Data Valid
 
I use the NI 6561 pci board to acquire the data
  • STROBE input is configured as clock
  • NIHSDIO_VAL_PFI1_STR/NIHSDIO_VAL_RISING_EDGE configure acquisition trigger to use the Data Valid line
  • niHSDIO_FetchWaveform
The app works ok but has a severe limitation - the number of samples to acquire has to be a fixed number
 
I would like to configure the board such that I would be notified when Data Valid goes low, and how many samples were acquired so that I could retrieve the data with niHSDIO_FetchWaveform
 
Thanks in advance
0 Kudos
Message 1 of 7
(3,726 Views)

Hi JohnCC,

If I understand you correctly, you want to trigger your acquisition with an external signal and only acquire the data you need. You can accomplish this by using a start and pause trigger. For example, configure your start trigger to execute on a rising edge and your pause trigger to execute on the falling edge of the same signal. You can then use the returned number of samples value from niHSDIO_FetchWaveform to determine your total number of samples actually acquired.

Please post if you have any questions. Have a great day!

Ryan D.
District Sales Manager for Boston & Northern New England
National Instruments
Message 2 of 7
(3,706 Views)

Ryan

I believe you understand me correctly, and I'd like to do what you suggest but I'm having difficulty.
I get an error message when I try to use the same signal for a start and pause trigger. Start must use an edge, and pause must use a level.  So a workaround was tried.

Since I want to acquire any time that data valid is high, I tried setting the start trigger attribute to NIHSDIO_VAL_NONE. The pause trigger was configured to NIHSDIO_VAL_LOW.

Now I have a problem when niHSDIO_FetchWaveform times out before the data buffer is filled. numberOfSamplesRead is returned as zero, even though  data was received.  When I reduce the samplesToRead argument to a smaller number to avoid the timeout, numberOfSamplesRead is correct and the data buffer is filled properly.
If niHSDIO_FetchWaveformU16 can be made to return whatever data that's been received even though the buffer isn't full, my goal will be achieved.

thanks

 

 

 

0 Kudos
Message 3 of 7
(3,631 Views)
JohnCC,

It sounds like the fetch is timing out before you can acquire all of your data. I would suggest increasing the timeout to the fetch by changing the maxTimeMilliseconds parameter for the niHSDIO_FetchWaveform function. A value of -1 causes the function to never timeout.
Regards,

Chris Delvizis
National Instruments
0 Kudos
Message 4 of 7
(3,618 Views)

Ryan

By using a polling loop that consists of a fetch waveform with timeout=0 and a getbacklog call, we are now able to collect data consistently.  Thanks very much for the pause trigger idea.

One of our configurations uses a pc<=>pc connection with an Ni6561 in generation mode on one pc and another Ni6561 in acquistion mode on the other.  The generation mode pc is emulating an embedded code app.  Is there any way I can connect the two Ni6561 boards and use same clock without requiring an extra cable between smb connectors?  The system works now but we'd like to just use a single cable.  The niHsdIo docs lead me to believe that an external clock source must be either STROBE on the DDC connector or ClkIn from the SMB connector.  Can you suggest some way to get around this limitation.  One idea was to export the sample clock on a PFI signal line and jumper the PFI to STROBE on the acquisition end.  But the cable connector wiring is very dense and we'd like to avoid that.

thanks again

0 Kudos
Message 5 of 7
(3,597 Views)
Hey John,

I think we may have a solution for you. Do you mind if we take this discussion offline?
Regards,

Chris Delvizis
National Instruments
0 Kudos
Message 6 of 7
(3,570 Views)

Ryan

I don't mind at all taking the discussion off line

If you need additional contact info please let me know

0 Kudos
Message 7 of 7
(3,563 Views)