02-19-2014 06:22 PM
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
02-20-2014 02:23 PM - edited 02-20-2014 02:25 PM
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?
02-21-2014 09:13 AM
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.
02-21-2014 09:45 AM
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.
02-21-2014 02:56 PM
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.
02-21-2014 03:00 PM
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.