Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

USB 6008 DAQ Read switch wiring

Hi i am looking to wire a magnetic read switch into the 6008 DAQ. The switch has just two wires and im just using it to count events.

If anyone could help that would be great.

Attached is the lab view progrem i have written for this task.

regards Gerry

0 Kudos
Message 1 of 6
(6,123 Views)

You just have a reed switch, which I assume is normally open? You just want to count the number of times it closes, correct? Do you need to know the duration of how long it's been closed or open?

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 2 of 6
(6,106 Views)

Hi, I am just using a normally open read switch. The switch has two wires and im using it to count each time the door is open and the time its open for.

 

0 Kudos
Message 3 of 6
(6,096 Views)

Gerry,

 

Because you are using the 6008 and want to determine the duration that the switch is closed then I would use a digital line and just poll it in software. Look at the Example Finder in LabVIEW (Help » Find Examples) and find either Digital - SW - Timed Input or Read Digital Channel. This will show you how to read a digital line in LabVIEW. You can use the Express VI, but I just looked for examples that would be similar to what you need.

 

From there you will use a loop to continuously measure the digital line. You will need to keep track of times that the digital line goes high (closed switch - I'm assuming you are probably just hooking one side of the switch to +5V) and then you can also count how long the digital line stay high. You probably don't need it overly accurate for your application. You can query the time when the line goes high, and then again when the line goes low and then subtract the two to get your time duration.

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 4 of 6
(6,094 Views)

Hi Aaron, Thanks for your reply. I have attached a photo showing the read switch and the DAQ 6008 that i am trying to wire it to. I am still unsure which ports to wire into. I have to wires coming out of the switch.

0 Kudos
Message 5 of 6
(6,089 Views)

Do you have a datasheet for the switch? I assume that it works such that when the magnet gets close the relay closes. If this is the case, you could connect one side to the 5V line on the 6008 and then the other side to a digital line of your choosing. Should be easy enough to try that out. You will just have to reference that digital line in your program so DAQmx (or DAQ Assistant) knows which channel to acquire data on.

Aaron W.
National Instruments
CLA, CTA and CPI
0 Kudos
Message 6 of 6
(6,086 Views)