LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

LIFA Product Feedback and Suggestions

Feature Request:

Add the AnalogReference() command to LIFA.

I'd like to be able to use the AnalogReference command to set it to either "External" or, using the Mega 2560, be able to use "Internal 1.1V" or "Internal 2.56V". The problem is that the Arduino ReadAnalog() command returns a 10-bit value that is subsequently converted to Voltage using a constant factor (0.0049) set as if only a Aref of 5V can be set.

The workaround of modifying the value from the Voltage output of the Read Analog Pin VI is fine for the short term, but it requires to be retested everytime there will be a modification to LIFA. I'd rather play with the conversion factor then the "Voltage" output, which by definition should be a voltage, not a fudge factor. I see two ways to deal with this:

1- Expose the ADC factor as a control terminal on the Analog Read Pin, and set it to default value of 0.0049.

2- Add a new LIFA primitive to select Analog reference, and modify the Analog Read Pin command to return 4 bytes instead of 2: first 2 bytes = 10-bit signal on analog pin; last 2 bytes = AnalogReference.

Personally, I much prefer the 2nd option. It seems more versatile and doesn't require any change to the current API's public connectors. It only adds one VI to the palette (added functionality). It is also transparent to the user as to the implementation of the factor for analog to digital conversion.

GCentral ChampionCLA
0 Kudos
Message 31 of 82
(2,708 Views)

Hi,

Just starting getting my hand dirty with arduino and LV. I was just going through the initial step of targetting the LVIFA base to my arduino uno and many errors came up. This is due to the new arrduino 1.0 release where a bunch of changes were implemented. See here for some details on this.

Is there an updated LVIDA around? I started changing some of this code, but more things are coming up, and I'd rather check around if someone knowledgeable has done it.

Other option for me to get started is to know which Arduino software version work with the current LVIFA?

Thx.

0 Kudos
Message 32 of 82
(2,708 Views)

BSI's original message doesn't show up in this thread.  Therefor I copied the following from his Email question.

"Just starting getting my hand dirty with arduino and LV. I was just going through the initial step of targetting the LVIFA base to my arduino uno and many errors came up. This is due to the new arrduino 1.0 release where a bunch of changes were implemented. See here for some details on this.

Is there an updated LVIDA around? I started changing some of this code, but more things are coming up, and I'd rather check around if someone knowledgeable has done it.

Other option for me to get started is to know which Arduino software version work with the current LVIFA?"

Arduino-0022 and Arduino-0023 both work with LIFA.  You can  download them from the same page you downloaded Arduino 1.0. 

Howard

0 Kudos
Message 33 of 82
(2,708 Views)

Thx Howard. I just did what you described to get around this.  0023 seems fine.

L.

0 Kudos
Message 34 of 82
(2,708 Views)

We had been using v0023 for development.  We are currently looking into supporting V1.0.  Watch for that support shortly.

-Sam K

LIFA Developer

0 Kudos
Message 35 of 82
(2,708 Views)

Hi

I am working with LIFA on a 2560 and I have been able to successfully program all the digital pins as Input or output but the Analog ones I can only configure then as inputs, for some reason they do not work as output (PinMode (Output))  and PinType (Analog)). I have realized as well that for most of the VI examples the number of analog pins is limitted from 0 to 7, when there are 16 Analog pins available on the 2560. I would appreciate any help on this. Thanks!

0 Kudos
Message 36 of 82
(2,708 Views)

Hey Mike2011,

The number of analog input pins on the 2560 is incorrectly limited to 8 as you have seen.  We have fixed this in version 2.0 of the toolkit (to be released soon) but for now I would suggest either editing the case of the Check for Pin in Range VI related to the 2560 or to not use the check for pin in range VI with your programs.  Post back with any questions.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 37 of 82
(2,708 Views)

Hello Kevin.

Thanks a lot for your answer. Do you have any idea why the Analog pins are not working as outputs? I have tried everything but they only work as inputs, for some reason the DigitalWritePin does not work.I have defined it as output with setPinMode. I was thinking it might be related with the LIFA, maybe there is a something there limiting the Analog pins to input only? I have not checked in details yet, just speculating...

0 Kudos
Message 38 of 82
(2,708 Views)

Hey Mike,

The Analog Pins on the Mega (and every Arduino I have used) are input only. The boards don't have the necessary circuitry to do both analog input and output.  Is the DigitalWritePin issue separate from the analog output issue?  That command can only be used with the digital outputs but should definitely work with the Mega board. When you write a digital output do you just not get a voltage change on the output pin?

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 39 of 82
(2,708 Views)

Hi Kevin.

I am pretty sure the Uno and the Mega Analog pins can be configured as outputs with digitalwrite cause I have done it with the arduino comands, i.e.,  digitalWrite (A0, HIGH); as example to control the output to HIGH or LOW state. The DigitalWrite issue I am having is related only with the analog pins only. I am able to get voltage changes in the Digital pins but not in the Analog ones.

Thanks

0 Kudos
Message 40 of 82
(2,708 Views)