Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital Input and counter synchronization with NI USB-6351

Hello, my goal is to do a an Hardware-Timed Acquisitions of 3 Digital input and 1 counter (connected to an encoder). All data must be time synchronized, in other words for any tick time i need to know the values of the digital inputs and of the counter. A NI user suggest me to create a first task Hardware-Timed (buffered Acquisition) for the 3 digital inputs using the internal 100 kHz Timebase Clock. Then a second task Hardware-Timed (buffered Acquisition) for the counter using always the internal 100 kHz Timebase Clock. Both task are start triggered by the same event (maybe another digital input). Is this the best (and easy) solution to the problem? As I said I need to (time) synchronize Digital inputs and counter (encoder position). 

When I make an Hardware-Timed Acquisition using internal clock, is there any timestamp in the capture data? 

 

Sorry but I'm really novice with the argument, any help will be very appreciated.

Regards, Franco.

0 Kudos
Message 1 of 6
(6,208 Views)

Hi Franco,

answering your last question, when you continuously acquire data, you can retrieve them from DAQmx Read in waveform format. This datatype easily allows you to retrieve a timestamp for each sample, as explained here. Otherwise, if you read data in array of double format, you can get timestamp data as shown in this example.

To synchronize digital input and encoder tasks, you can use the same timebase as sample clock for both tasks and use the same start trigger (as you suggested). You have also other possible solutions. First if you have an external sample clock you can use that as the clock for both the encoder task and the digital task.
If you do not have an external sample clock you can use another counter to generate a pulse train and use that output to clock both tasks. In this case as long as you ensure that both the angular encoder task and the digital task have started before you start the pulse train you do not need to worry about a start trigger. You can find an example (though related to digital input-output synchronization) here.
These are only some of the possible solutions.

I hope it helps!
Bye,

 

Licia

0 Kudos
Message 2 of 6
(6,179 Views)

Thanks for your answeer.

At the moment I'm planning to avoid Labview approach, programming directly in C language. First of all I'll try to use 100KHzTimebase internal clock and common trigger (PFI port) for both tasks.

I tried some test with MAX and using a Simulated USB 6531 device (I'm waiting the delivery of the physical card). I've no problem to create a task for digital line input with above features. Instead when I create the task for Angolar Position capture, I'm not able to setup the trigger event. There are no Tab for triggering configuration! Is this a limit of Simulated Device (or MAX)? The X series card manual is clear about this point "Counter input operations can use the arm start trigger to have start trigger-like behavior".

 

Franco.

0 Kudos
Message 3 of 6
(6,162 Views)

Hi Franco,

you are right, X series cards support Arm Start Triggering, as explained here.

You have to set it in software (as it is an advanced trigger type) as explained in DAQmx help.

Bye,

 

Licia

0 Kudos
Message 4 of 6
(6,157 Views)

What do you mean with "You have to set it in software (as it is an advanced trigger type)"?

I've to set it using software (e.g. C API for NI-DAQmx) and I can't use MAX for this scope?

I'm looking the NI-DAQmx help but I can't find this point.

 

Thanks again for your help.

 

Franco.

 

0 Kudos
Message 5 of 6
(6,152 Views)

Hi Franco,

in MAX you cannot set Arm Start Trigger as it is an advanced trigger type.

You can set it using property More >> Arm Start >> Trigger Type, as explained in DAQmx help.

I hope this helps!

Bye,

 

Licia

0 Kudos
Message 6 of 6
(6,136 Views)