LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Elapsed time between two photocell

Solved!
Go to solution

Hello everyone,

I have to build with:

  • a cDAQ 9171
  • a module NI 9423
  • two photocells

a kind of timer. When the first photocell is crossed by an object must start, and must stop when the second is crossed. I have seen lot of examples here with the start triggered, but always with a timed stop, not with a second hw trigger.

 

Can someone help me? 

0 Kudos
Message 1 of 7
(2,444 Views)

Sounds like a counter task configured for Two-Edge Separation measurement.  The shipping example that refers to Pulse Width & Frequency actually *also* supports Two-Edge Separation measurement.  The property nodes used to configure the terminals for the start and stop edges can be expanded to allow you to specify the polarities of each, as needed.

 

Further note that the counter channel will be one of the counters built into your chassis while the photocell signals will be specified as input pins of your 9423 device.  Just be sure the photocell signal is conditioned to be compatible with your input module.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 7
(2,408 Views)

Seems pretty straight forward to me...

 

I would monitor the photocells with a simple DIO input since all you need to know is if the beam is broken or not (on or off).

 

  1. Photocell 1 beam broken
    1. Start timer
  2. Photocell 2 beam broken
    1. Stop timer
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 7
(2,407 Views)
Solution
Accepted by topic author paveltex86

Thanks,

I've done as in the attachment (the 2 buttons simultaes the photocells) and it works.

0 Kudos
Message 4 of 7
(2,341 Views)

What time scale and resolution are you dealing with?

 

Based on prior threads here, I kinda figured that the use of photocells implied that you'd want pretty fine time resolution and accuracy.  The counter/timer task approach I suggested will give you resolution and accuracy in the sub-microsec realm.   Using Windows and software timing queries will put your accuracy in the multi-millisec realm.

 

If you're measuring 5 second intervals and you have a 12 msec error, maybe no big deal.  But if you're trying to measure much smaller intervals, the inaccuracy and uncertainty of software timing *may* be a big deal.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 5 of 7
(2,335 Views)

You're right, but I'm not able to do this… Can I ask you some examples about?

 

Btw, the time intervals are around 1 s, the photocells delay is 1ms. 

0 Kudos
Message 6 of 7
(2,327 Views)

The example I referred to in msg #2 can be found in the menu at "Help-->Find Examples...", then choose "Hardware Input and Output-->DAQmx-->Counter Input".

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 7 of 7
(2,269 Views)