LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continuously reading two sensors (alternatively) in an event structure

Solved!
Go to solution

Hello,

 

I have an event structure with various functions from user interface. The whole application is about controlling a laser diode and reading two IR light sensors which cover different wavelengths (Si and InGaAs). Both sensors are connected to the same AD converter, but to different channels. So if I want to read from both sensors I have to change the channel setting on AD converter. The real question is how to implement countinuous reading of both sensors in the event structure? I want to be able to read alternatively each sensor in a timespan of 50 or 100 ms. Is there any way, other than using timeout function of the event structure with some kind of xor logic for switching the channels? Maybe something with more functionality (somehow by a timed loop)?

Any idea is welcome.

 

Thanks and Regards,

 

Gregor Primc

 

P.s. The sensor reading is done by a National Instruments SPI card where SPI is the master.

0 Kudos
Message 1 of 6
(2,990 Views)

This VI may solve your requirement,if this VI is once fired by user event from Front Panel,it will start alternatively firing with out any user event

 

You can use this type of logic to implement your acquisition

AB
Kudos are Accepted
0 Kudos
Message 2 of 6
(2,984 Views)

Hey,

 

thanks I will check it out. Could you post the vi in 2010 or 2011 version? I have version 11.0f1...

 

Regards,

Gregor Primc

Message 3 of 6
(2,978 Views)
Solution
Accepted by topic author grega

2010 down converted VI

AB
Kudos are Accepted
0 Kudos
Message 4 of 6
(2,970 Views)

If you are constantly reading, I would recommend making a separate loop for the reading.  You can easily then change which sensor you are reading whenver you want.  You will need to setup some type of communication between the loops using queues/notifiers and events.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 6
(2,945 Views)

Hey,

 

thanks for the solutions. However I have another question. What would be the best way to do a reading for 3 different sensors (from the same AD, different channels) every 50 ms for each sensor, and reading another sensor (temperature, which is also on the same AD, but different channel) each 200 ms.

- do you propose two loops with events, where in one loop in enqueue different reading tasks for each sensor (how can incorporate different time scales)

- or maybe only queues with case structure

- or maybe some form of timed loop?

 

Thank,

 

Grega

0 Kudos
Message 6 of 6
(2,898 Views)