LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read/wait for an incoming pulse signal?

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! 

 

0 Kudos
Message 1 of 5
(3,292 Views)

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".



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 5
(3,287 Views)

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!

 

0 Kudos
Message 3 of 5
(3,270 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 4 of 5
(3,258 Views)

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.

0 Kudos
Message 5 of 5
(3,249 Views)