Programming Arduino Using LabVIEW (Reverse Engineer C Code) URGENT!!

Ok, so I really need some help. I want to use LabVIEW as an Interface for my Arduino which is currently controlling a little system. The Arduino is programmed in C, and is connected to a tiny LCD display. Is there a way to get LabVIEW or some other software to act as the interface rather then the tiny display?

Thanks!

Is there a way to get LabVIEW or some other software to act as the interface rather then the tiny display?

Yes. More details would be useful. What does the screen control today?

Thanks for the reply.

The touchscreen set parameters of a small power system, i.e. voltage, phase, etc. More specifically, it controls the arduino which is connected to a fpga chip

Clearly, my hint wasn't sufficient. So, off with the gloves. POST YOUR CODE!

Getting data from source a vs. source b is usually trivial, IF you know what you need AND how to wait for data. Or, specifically, how to use the data only when it arrives.

My bad, clearly didn't get the hint :slight_smile: . The code is quite long unfortunately, as most of the code involves getting numbers from the user through the touchscreen, and sending things to the display which is then followed by the communications with the FPGA.

UWA_UI_mega14i.ino (32.7 KB)

  while ( state == 2 ) {
    state = 1;

While the while statement is ONE tool, it is NOT the only tool available. This is a piss-poor use of while in place of a simple if.

Start my making a list of the variables that you want to have LabView value. Then, define what Labview needs to send to value one of the variables. Then, implement the code to read whatever LabView sends, storing it until the end of a packet arrives. When that happens, parse the data, set the variable, and reset for the next packet.

Writing code so that loop() is over 1000 lines is a recipe for disaster. No function should ever, when printed, span more than one page. If it does, some serious refactoring is in order.

Awesome, thanks for the help!

There is another recent Thread (yesterday?) along similar lines.

I would expect the touchscreen stuff to occupy a great deal of the Arduino code and maybe none of it would be needed if you use a PC program as the interface.

It might be easier just to write a whole new Arduino program.

As far as receiving data from Labview (or anything else) is concerned the examples in serial input basics are likely to be useful.

...R