LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the binary data from ADC of Arduino?

I'm working in a University project with Arduino and Labview (LIFA). I need to oversample a signal from ADC for enhancing the ADC resolution. As you know, arduino mega has a 10 bits ADC, and I need 13 bits. To do this I need to have the binary data from Arduino, and not the integer data that I have in the block of labview. Do you know where is that data?. I know that I can open the predesigned block, and I did it, but I don't know where are that data. Can you Help me? Did you understand me? Beforehand ,thanks so much!

0 Kudos
Message 1 of 6
(8,217 Views)

An alternate approach is to convert the integer data to binary data.

hrh1818

0 Kudos
Message 2 of 6
(5,759 Views)

That isn't enough, I need to do oversample for enhancing the ADC resolution from 10 to 13 bits, by that reason I need the data just before of convert to binary

0 Kudos
Message 3 of 6
(5,759 Views)

Sorry you lost me.  The Arduino Uno uses a successive approximation ADC.  The  Input to the ADC is analog and the ADC converts the data to binary.  No intermediate form between analog and binary data exists in the Arduino Uno.

If you must have 13 bit resolution use an external 13 bit ADC.

hrh1818

0 Kudos
Message 4 of 6
(5,759 Views)

jaja sorry. I explain better, there is a method that allow enhancing the ADC resolution without using a external ADC. (I'm talking about this http://www.atmel.com/images/doc8003.pdf). When you read the analog valué from arduino uno or arduino mega, you have a valué between 0 and 1024. I need get that value in labview.

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

Inside the Analog Read VI the Send Receive VI returns a string.  This stirng contains two bytes which store the 10 bits of the ADC conversion.  I used a String to Byte array to get the bytes.  The first byte (index 0) is the 8 LSb of the analog sample.  The second byte (index 1) is the upper two bits of the analog sample.

The analog read port VI does much the same thing except it packs all 6 samples into 8 bytes (6 10 bits samples = 60 bytes so the we need at least 8 bits to store all the data).

Here is the code that packs the Analog Read Port samples:

  char output0 = (pin0 & 0xFF);  

  char output1 = ( ((pin1 << 2) & 0xFC) | ( (pin0 >> 😎 & 0x03) );

  char output2 = ( ((pin2 << 4) & 0xF0) | ( (pin1 >> 6) & 0x0F) );

  char output3 = ( ((pin3 << 6) & 0xC0) | ( (pin2 >> 4) & 0x3F) );   

  char output4 = ( (pin3 >> 2) & 0xFF);   

  char output5 = (pin4 & 0xFF);

  char output6 = ( ((pin5 << 2) & 0xFC) | ( (pin4 >> 😎 & 0x03) );

  char output7 = ( (pin5 >> 6) & 0x0F );

Let us know if that helps.

Thanks

-Sam K

LIFA Developer

LabVIEW Hacker

Join / Follow the LabVIEW Hacker Group on google+

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