LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Possible bug in LabVIEW?

I am a beginner on Arduino but not on electronics in general and not on LabVIEW. I have also problems with error 5002. But after letting my small LabVIEW program try to get connected to the Uno up to 5 times before I display the error message, that is not a problem any more. Normally my program gets connected on the 2:nd attempt. But I have another problem. I have connected 4 switches and pull-up resistors to analog inputs A0 to A3. So I actually use A0 to A3 as digital inputs. When I activate a switch a corresponding indicator is turned on on the front panel. Inside a case structure I have copy of the Hello World example program. The only difference is that I can choose between 2 different texts. As long as the case structure is false, i.e. no texts are displayed, everything works o.k.. But as soon as I print the first text on the LCD display, by activating the program block inside the case structure, my switches and the indicators on the front panel don´t correspond any more. If I press switch1 which is connected to A0, indicator 2 on the front panel is turned on instead of indicator 1. Switch 2 turns on indicator 3 and so on. Sometimes switch 1 turns on indicator 3, and then switch 2 turns on indicator 4 and so on.

0 Kudos
Message 1 of 7
(6,862 Views)

P_Brand wrote:

I am a beginner on Arduino but not on electronics in general and not on LabVIEW. I have also problems with error 5002. But after letting my small LabVIEW program try to get connected to the Uno up to 5 times before I display the error message, that is not a problem any more. Normally my program gets connected on the 2:nd attempt.

You may need to increase the timeout [terminal] on the "Send Receive.vi" in "Init.vi".  Default is 100ms.

P_Brand wrote:

I have connected 4 switches and pull-up resistors to analog inputs A0 to A3. So I actually use A0 to A3 as digital inputs. When I activate a switch a corresponding indicator is turned on on the front panel. Inside a case structure I have copy of the Hello World example program. The only difference is that I can choose between 2 different texts. As long as the case structure is false, i.e. no texts are displayed, everything works o.k.. But as soon as I print the first text on the LCD display, by activating the program block inside the case structure, my switches and the indicators on the front panel don´t correspond any more. If I press switch1 which is connected to A0, indicator 2 on the front panel is turned on instead of indicator 1. Switch 2 turns on indicator 3 and so on. Sometimes switch 1 turns on indicator 3, and then switch 2 turns on indicator 4 and so on.

I'm not entirely sure what is going on here but have you checked the actual voltages that are getting to the AI pins and the voltage received by "Analog Read Pin.vi" and compared them?  Is it reading it accurately?

0 Kudos
Message 2 of 7
(3,085 Views)

Thank´s for taking your time. I changed the timeout value to 500 ms, but same problem. I can live with that, even if my "quick fix" has to be improved.  About my other problem: As soon as I send a text message to the LCD, the analog readings on "Analog Read Pin.vi" changes from 5.01 to 319.887. 5.01 is very close to the supply voltage from the USB cable (4,96 V), but where does the other value come from? Disconnecting the LCD display doesn´t make any difference. But if I remove the "LCD Print.vi" inside the Case structure, everything works as it should.

0 Kudos
Message 3 of 7
(3,085 Views)

Is there a reason why you are not using digital pins for your physical switches?  What happens if you switch to digital pins?

0 Kudos
Message 4 of 7
(3,085 Views)

I am using this hardware for another project, which doesn´t involve LabVIEW. My aim was only to learn about LIFA. It would be interesting if some LIFA expert at NI could do a check. It´s actually very easy to verify. A "bare" Uno board plus a switch and 4 pullup resistors is all that is required. No need for an LCD display, as I have the same problem with and without the LCD connected to the Uno board.

0 Kudos
Message 5 of 7
(3,085 Views)

Can you post a circuit schematic of how you have everything connected?  If your resistor values are too low its possible that you are browning out the Arduino (the LCD command might push the power draw over the edge).  What values are you using for the resistors?

If you can, try powering the Arduino with a decent PSU (1A+) to see if it still happens.

Also as Nathan mentioned can you hook up a DMM to the analog inputs to confirm the voltage looks right when the buttons are pressed / released.

Thanks,

-Sam K

0 Kudos
Message 6 of 7
(3,085 Views)

Thank´s for your response. I am on vacation now. When I return home I will answer your questions.

0 Kudos
Message 7 of 7
(3,085 Views)