From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PCIe-6321 Setup / Digital Read

I'm working to create a new test fixture for one of our in-line tests using LabVIEW to automate the process. I am currently working on this motor initialization to set up for the motor test. Motor operation is based on two optical sensors at opposite positions being flagged off of the motor's rotation. However, when running the program, the input lines of the DAQ are always either 0 VDC or 5 VDC. I am expecting to see a signal of ~3 VDC when the sensors are not blocked, and 0 VDC when they are. When the motor rotates and sensors are flagged, the values don't change from either 0 or 5 VDC.

 

It seems that maybe my PCIe-6321 may be initialized incorrectly? I've used this Digital Read function successfully earlier in the project, and do not think the issue lies there. Or the problem may be something else entirely.

 

Download All
0 Kudos
Message 1 of 5
(880 Views)

Hi BSAL,

 


@BSAL84 wrote:

It seems that maybe my PCIe-6321 may be initialized incorrectly? I've used this Digital Read function successfully earlier in the project, and do not think the issue lies there. Or the problem may be something else entirely.


When you think it is a good idea to constantly create and kill DAQmx tasks all the time then you should (really) rethink your whole application design!

 

And why do you expect ~3V from digital inputs? Digital data are either TRUE or FALSE (aka "0 or 1")…

Best regards,
GerdW


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

Could you please provide an example of a better way to do this? I based this off of the existing program we have running. This is my first LabVIEW project and would appreciate any pointers.

 

The sensor PCB usually outputs about 3V when the sensor is clear and 0V when blocked. Reading with a multimeter on the PCB I would never expect to see 5V at that point and only expect 0V if the sensor was blocked. Would it be better to use an Analog Read for this task then?

0 Kudos
Message 3 of 5
(831 Views)

Hi BSAL84,

 

The PCIe-6321 card seems to expect a logic signal between 0 and 5 V. Since you are supplying a signal between 0 and 3V, you are likely not going over the treshold for it to register a TRUE (5V). Because typically, a FALSE could be a voltage between 0 and 1.5V and a TRUE could be a voltage of 3.5V and 5V (to pull some number out of thin air). So anything between 1.5V and 3.5V could be an unknown state, so the card could just output a FALSE by default.

 

The only acceptable use of auto-starting or starting and closing a DAQmx task should be when you need to perform a slow, one-off action, such as, closing a relays to setup an automated test. If you need to monitor channels, it would be best to keep the task running and continuously read the channels. This is because it takes a relatively long time to start and stop a task. You could even be missing the signal going TRUE.

 

So at the very least, you should open a task before your while loop and close it only after the loop has stopped. I don't have access to DAQmx at the moment, but hopefully you get the idea.

0 Kudos
Message 4 of 5
(820 Views)

The PCIe-6321 datasheet lists 2.2V -> 5.5V as a valid input High, and 0->0.8V as valid input Low, so 3V should register as a high digital input.

 

If the motor is rotating and the values are changing, then as others have said you might be having trouble with timing - you should change your software setup to avoid repeatedly creating and clearing the DAQmx tasks.

 

Since you mentioned 5V and the PCB, along with a multimeter, I'm guessing you're probing the physical board manually (outside of LabVIEW, possibly whilst the code is running) and you're not getting expected values.

This might be because they're changing quickly and your multimeter does some averaging, or it might be the value is being dragged to a higher voltage. However, if the maximum (when time resolved) value is ~3V, reading 5V can't be an average of correctly measured values...

Are you sure you're probing relative to the correct "ground" level?

The 6321 has "pull-down" resistors, but these also shouldn't produce a 5V level (if you had pull-up resistors, that might be the cause).

Does your PCB include any pull-up resistors maybe?


GCentral
Message 5 of 5
(814 Views)