03-23-2012 08:27 AM
I'm looking for guidance on how to read a single TTL pulse of 50 millisecond width. (The pulse indicates a remote instrument is ready for further input.)
My program needs to wait for the pulse to occur and then proceed. If the pulse doesn't arrive in say 5 seconds I want to stop waiting and notify the operator.
Can this be done with a binary/analog input channel or do I need a counter/timer input?
If I read a binary input channel repeatedly from inside a loop then there's a change I'll miss the pulse between reads.
I want to use a binary input because I have one available. To use a counter/timer I'll have to devote another I/O module.
thanks!
03-23-2012 09:10 AM
You could try looking at DAQmxRegisterSignalEvent () function. Here a small KB item about this command.
You should also have ReadDigChan-ChangeDetectionEvent example installed somewhere in your machine: you can search with the example finder with keyword "change".
03-26-2012 01:29 PM
Thanks Roberto. Great response as always.
I'm investigating whether the serial line interface (com port) can transmit and receive a single pulse (bit). That could eliminate the need to purchase additional I/O hardware for my application.
I found a CVI function called InstallComCallback(). It's description says it executes a callback when certain events occur on the com port. Could one of those events be a single pulse? I'm investigating how the function works but my knowledge of serial communications is limited.
Does serial communications involve only full characters (8 bits?) at a time or can InstallComCallback() be tricked into executing the callback when a single bit (pulse) is received on the serial receive pin (pin 2?) ?
Does InstallComCallback() requre 8 bits before executing the callback? Or will a single "bit" do the trick?
I may eventually answer these questions through experimentation but at the moment I'm struggling.
thanks!
03-27-2012 01:48 AM
Serial port is not capable of detecting single bit transmits: serial communications involves a small protocol to encapsulate single bits so that a complete character is received so it won't be a solution in your case.
I never tried it but you may want to investigate the possibility to install a callback on some control signal on the serial line: see the help for event mask in InstallComCallback for a list of available signals. As I told you, I never made tests on this subject so you'll have to experiment yourself and search some documentation to understand those signals and how to manipulate them.
03-27-2012 08:14 AM
Thanks again Roberto.
I value your opinion even if you have not tried it.
Your suggestion to investigate the RS-232 control pins to detect a pulse instead of using the input data pin is a good idea.