LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading DAQ value inside Event structure does not counting

Solved!
Go to solution

i created a counter using event structure. by pressing button it counts good.

now i want to modify it such that read signal from DAQ (IR Sensor) . as signal is hight, it should count as push button (replaced push button with output of DAQ.

But reading from DAQ not woring in loop so no counting.

Please guide.

 

 

Asif138_0-1716394495520.png

i want to replace input button with daq output which is sensor signal. i dont have DAQ so can not place its block here. 

please tell why DAQ signal not being read here. when i use seperate while loop DAQ signal is being read.

how can i modify this counter to count when sensor output is high?

 

Download All
0 Kudos
Message 1 of 6
(512 Views)

Hi Asif,

 


@Asif138 wrote:

But reading from DAQ not woring in loop so no counting.


How do you know the DAQ reading does not work inside the event case?

 

On your counting problem: there is a "default if unwired" output tunnel at the event structure: as soon as any other event kicks in your counter value in the shift register is (probably) cleared…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(498 Views)

@GerdW wrote:

 

On your counting problem: there is a "default if unwired" output tunnel at the event structure: as soon as any other event kicks in your counter value in the shift register is (probably) cleared…


 

(Sorry, your snippet is too new, cannot look at the actual code.)

 

In addition, there should be no orange anywhere. counting is an integer process!

Also your count indicator should be before the event structure so it correctly resets to zero at the start of the program and before events got triggered (no local variable needed!). Your button should be latch action (again no local variable needed!) What happens to the count in other events. Is there one to decrement, for example?

 

If you have problems with DAQ, you should show that code! Event structures are typically for user interactions (yes, there are exceptions!), so just eliminate the event structure and poll you sensor at a reasonable rate and act accordingly.

0 Kudos
Message 3 of 6
(466 Views)

Thank you for your reply.

My concern is to read IR sensor output in LabVIEW and count whenever it detects objects.

the counter works fine if i use push button and press it.

when replacing push button with IR output it is not working. 

this issue was shared my one friends. i currently do not have DAQ. i worked on his computer and check it is  not working with DAQ .

I have attached code 2020 version please suggest or modify it.

 

0 Kudos
Message 4 of 6
(443 Views)
Solution
Accepted by topic author Asif138
  • Please do not maximize the diagram to the screen. That is super annoying!
  • You still have an infinite timeout event case that does noting
  • You are still counting in orange.
  • Your count is still not wired across l event case.
  • That 500ms wait has no purpose
  • There is no way to stop your loop
  • Events are for user interactions. You don't need an event structure to poll a sensor.

See if this can give you some ideas.

 

altenbach_0-1716443963117.png

 

I recommend the learning resource listed at the top of the forum.

0 Kudos
Message 5 of 6
(435 Views)

Thanks alot. 

 

 

0 Kudos
Message 6 of 6
(417 Views)