LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert a analog signal to digital signal

Solved!
Go to solution

Hello,

How to convert an analog signal into digital signal such that every sample of analog signal corresponding to 1.2V will be represented as '1' in digital signal and other samples of analog signal(that are not 1.2v) will be represented(converted) as '0' in digital signal.

And how to display both wavefroms or signals in graph indicators.

Thanks.

 

0 Kudos
Message 1 of 11
(7,095 Views)

You need to choose a threshold to what is considered a 1 and 0.  Sounds like you chose 1.2V.  So just take your array and use the Greater Or Equal? function to compare all of your elements to 1.2.  You can then use the Boolean to 0,1 function to change to a 0 or 1.


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
0 Kudos
Message 2 of 11
(7,089 Views)

Use the "In Range and Coerce" primitive and feed the Value and for max and min set 1.2V +/- 0.2 or something to have a threshold. So if it is around 1.2 you will get "High" else you will get "low" boolean values. If you still want 0 or 1 out of it, then wire the boolean to "Boolean to (0,1)" primitive.

 

Edit: Tim, you are way to fast. 🙂

-----

The best solution is the one you find it by yourself
0 Kudos
Message 3 of 11
(7,087 Views)

As posted by the cheat previously a better solution for a noise signal is to use a two level threshold.

 

http://forums.ni.com/t5/LabVIEW/Two-Threshold-Analog-to-Digital/td-p/2738762

0 Kudos
Message 4 of 11
(7,059 Views)

@Hooovahh wrote:

As posted by the cheat previously a better solution for a noise signal is to use a two level threshold.

 

http://forums.ni.com/t5/LabVIEW/Two-Threshold-Analog-to-Digital/td-p/2738762


I forgot about that thread.  That was a fun little thing to get working.


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
0 Kudos
Message 5 of 11
(7,048 Views)

Hi,

With your suggestions I tried like this but I don’t know how to get a continuous digital sqaure signal (waveform) plot of the converted analog waveform.

Can anyone help me to the required?

 

Download All
0 Kudos
Message 6 of 11
(7,045 Views)

You are reducing 1000 samples to a single scalar. You probably should operate on all 1000 elements at each iterations of the loop.

0 Kudos
Message 7 of 11
(7,036 Views)

I tried with a "collector" by taking 1000 samples but was unable to get the digital(sqaure pulses) waveform.

0 Kudos
Message 8 of 11
(7,035 Views)

Hi Stefan,

 

please go through all available online courses for LabVIEW. NI offers a lot of them!

 

check.png

When you want to learn LabVIEW you should stay away from ExpressVIs and the DDT…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 11
(7,031 Views)
Solution
Accepted by topic author stefan57

If you have 1000 samples, and you want to convert to digital, you are going to get 1000 digital values.  Attached is what I mean.

0 Kudos
Message 10 of 11
(7,030 Views)