From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital change at the same time?

I need to test 5 digital channel. Make sure the digital change of the 5 channel happen at the same time, when a certain external signal is given. I have no idea how to do this? Any one has any suggestions?

 

I am using PCI-6229.

 

Thanks.

0 Kudos
Message 1 of 18
(3,477 Views)

How accurate is "at the same time"? The easy was would be to connect your digital channels to analog input channels and log continously. The sampling rate of your card is 250 kHz. If you monitored 5 chanels, the channel time difference would be 0.02 ms from chan 1 to chan 5.

0 Kudos
Message 2 of 18
(3,463 Views)

Hello,

 

If you are checking for simultaneous start up, you would need to use analog input channels to record the signal.  The PCI-6229 M Series DAQ has one ADC and all channels MUX to that ADC based on your scan list.  So you will not be able to simultaneously scan all 5 digital channels, but you can somewhat account for inner channel delay based on the spec of the board.  If you need to measure simultaneously I would recommend looking into S Series DAQ cards.

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 3 of 18
(3,444 Views)

Hi ossoo,

 

Did you try this idea?

 

 

Best Regards,

John Passiak
0 Kudos
Message 4 of 18
(3,434 Views)

can you use this device to read the whole digital port rather that 5 seperate lines?

0 Kudos
Message 5 of 18
(3,397 Views)

Hi Scott,

 

Yes, you can reference the multiple lines like this:

 

2010-10-11_175607.png

 

 

Single-sample data can be read as an integer (u8, u16, or u32 depending on how many lines are on your port), a boolean array, or a digital waveform.  Multiple-sample data (buffered DI) can be read as an array of integers or as a digital waveform.

 

 

Best Regards,

John Passiak
0 Kudos
Message 6 of 18
(3,390 Views)

Hi John,

I wrote the code in the file attached. Use counter for timing and DI for digital change detection.

 

But, I meet another problem. How can I tell which is rising edge and which is falling edge of the signal digital change?

 

I did a experiment with a 1KHz 30% duty cycle digital signal which connect toP0.0 and P0.1. So the two channel have the same input. So I got 3 and 0 using U32 which may represent digital change. The problem is sometime the time from 3 to 0 is 3E-4 second (1/1KHz x 0.3) and sometimes it is 7E-4. It is kind of random.

 

What should I do if I want to know  which is for rising edge and which is for falling edge?

 

Thanks

0 Kudos
Message 7 of 18
(3,324 Views)

Hi ossoo,

 

You have wired sources for both rising and falling edges in your DAQmx Change Detection vi.  If you are only interested in rising edges, remove the source control for the falling edges.

 

rising.PNG

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 8 of 18
(3,298 Views)

Hi Kyle A,

Actually, I am interested in both rising edge and falling edge. Is there any way to figure out which is which from the data collected?

 

Thanks

0 Kudos
Message 9 of 18
(3,287 Views)

Hi ossoo,

 

If you look at the Digital Data, you have an array of [3, 0, 3, 0, 3, ...].  The binary bits of these numbers correspond to the lines on your board.  So, with two lines there are four possible states:

 

0 = 00 = both lines are low

1 = 01 = p0.0 is high, p0.1 is low

2 = 10 = p0.1 is high, p0.0 is low

3 = 11 = both lines are high

 

You can tell what transitions are being measured by comparing the current sample with the previous one.  So, a transition from 0 to 3 means both lines had a rising edge at this time.  A transition from 3 to 0 is a falling edge.

 

Here is the data from your VI (sorry it doesn't quite line up):

 

2010-10-21_130952.png

 

You mentioned a 30% duty cycle at 1 kHz, which the above data shows.  The low time is ~700 us (the measurement is taken on the rising edge of your signal, which corresponds to a 3).  The high time is ~300 us (the measurement is taken on the falling edge of your signal, which corresponds to a 0).

 

 

Best Regards,

John Passiak
0 Kudos
Message 10 of 18
(3,279 Views)