Hi,
I have a question about receiving a TTL pulse from an external input and I want to implement it in Python. Once I receive the TTL pulse, I will use it to trigger my code. Could you please give some suggestions where to start? Do I need to do the push-pull connection to initialize the digital input pin to low? How to continuously read this pulse? Thanks in advance!
There are two options depending on pulse width. In both cases you connect your TTL pulse signal to a digital I/O, and in a loop poll the U3 to detect the pulse.
Option 1: If your pulse width 10 ms or greater, you can just read the digital I/O state in a loop and detect the change in states. When you detect the change from low to high, and then back to low, a pulse occurred. The quickstart demonstrates reading from a digital I/O.
https://labjack.com/support/software/examples/ud/labjackpython/low-level
Option 2: Configure and use a counter on a digital I/O line. Read the counter value in a loop with the reset option. When the counter value is >= 1, a pulse or multiple pulses were detected. Counts occur on falling edges. Here some example code here on configuring (configIO) and reading from the counter (getFeedback with u3.Counter):
https://labjack.com/support/datasheets/u3/low-level-function-reference/f...
Configure once before your poll loop and then use the getFeedback call in your loop to read the counter value.
I appreciate your immediate response, and the 2nd option worked for me because the pulse width is about 0.2 ms. Thanks!