PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

NI PXIe-6345 digital signal edge detection

Im trying to detect the falling edge of the digital signal coming in Dev1/port0/line0 of NI-6345 using NIDAQMX python library.

This is my code snippet

 

 

 

    with nidaqmx.Task() as task:
        channel=task.di_channels.add_di_chan(channel)
        task.timing.cfg_change_detection_timing(rising_edge_chan="/Dev1/port0/line0",
                                                falling_edge_chan="/Dev1/port0/line0",
                                                sample_mode=AcquisitionType.CONTINUOUS)

        start=time.time()
        while True:
            sample= task.read()
            print(f"Falling edge detected: {sample}")
            break
        difftime= time.time()-start
        print("difftime=",difftime)   

 

 

 

but I'm getting the following error

 

 

 

Traceback (most recent call last):
  File "/home/user/measurePulse.py", line 201, in <module>
    waitUntilSignalTransition()
  File "/home/user/measurePulse.py", line 95, in waitUntilSignalTransition
    sample= task.read()
  File "/home/user/.pyenv/versions/3.10.7/lib/python3.10/site-packages/nidaqmx/task/_task.py", line 623, in read
    _, samples_read, _ = self._interpreter.read_digital_lines(
  File "/home/user/.pyenv/versions/3.10.7/lib/python3.10/site-packages/nidaqmx/_library_interpreter.py", line 4541, in read_digital_lines
    self.check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)
  File "/home/user/.pyenv/versions/3.10.7/lib/python3.10/site-packages/nidaqmx/_library_interpreter.py", line 6408, in check_for_error
    raise DaqReadError(extended_error_info, error_code, samps_per_chan_read)
nidaqmx.errors.DaqReadError: A hardware failure has occurred. The operation could not be completed as specified.

Task Name: _unnamedTask<0>

Status Code: -50152

 

 

 

I'm a bit new with NI cards, and I couldn't figure out if the NI6345 digital lines can detect edges.

Any help on this matter is greatly appreciated

0 Kudos
Message 1 of 5
(162 Views)

What do you want to do after detecting the falling edge?

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 5
(148 Views)

I wanted to detect the falling edge of the signal and return from this function.

0 Kudos
Message 3 of 5
(124 Views)

So, you need a way to detect a digital edge transition to proceed/do something in software.


Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 4 of 5
(112 Views)

Exactly

0 Kudos
Message 5 of 5
(107 Views)