LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert analog scalar into digital value

I have the DAQ connected to a system that sends a digital 0 or 1 through the analog BNC connector. If I use DAQ Express VI, I can convert the dynamic data type into a boolean (rather than scalar) array so it's easy to check if the value is 0 or 1. Because I'm running the VI in real-time, I can't use dynamic-to-boolean array conversion. The output I get is a 1-D waveform array which will give me scalar values. The task has a voltage range of -10 to 10 mV. How can I convert that into a 0 or a 1? Should I set the voltage range to 0-5V and simply have an if statement that checks if the value is, let's say, greater than 2.2V (which will mean it's a binary 1)? Is there a better method?

 

Thanks. 

0 Kudos
Message 1 of 3
(3,131 Views)

Hi abdel2,

 

It sounds like you are trying to measure digital data from your system. If that is the case, you should be able to connect to a digital input line if your DAQ card had them. Then you can set up a digital acquisition in LabVIEW that will interpret the signal as a boolean input.

 

If you are not able to do this, you can approximate the digital behavior by reading analog data, and pragmatically determining a threshold (for example 2.2V), though this is a less efficient way to do it.

 

Regards,

Stephen S.

National Instruments
Applications Engineering
Message 2 of 3
(3,093 Views)

I guess digital lines would be better than analog but I am using BNC connectors right now. I need a wire connection for digital input. Maybe I'll replace them later but for now I'm working with analog connectors. I just implemented an amplitude check (>2.2 V = 1) and it seems to work great.

 

Thanks. 

0 Kudos
Message 3 of 3
(3,068 Views)