LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with LCD screen

I recently bought this serial LCD screen to use with my arduino. I've got the LCD working in Labview after editing the LabVIEWInterface.ino file to add a new switch-case command. I have some static text that will always be shown on the LCD, but I want 2 numeric fields to be passed by labview. Here's my switch-case to show you what I mean;

    /*********************************************************************************

    ** SerialLCD

    *********************************************************************************/

    case 0x2E:

      // Initialize LCD module

      lcd.init();

 

      // Set Contrast

      lcd.setContrast(50);

      // Set Backlight

      lcd.setBacklightBrightness(8);

     

      lcd.home();

      lcd.print("Current Temp:");

      lcd.print(command[2]);

      lcd.setCursor(2,1);

      lcd.print("Set Temp:");

      lcd.print(command[3]);

    

      break;

The attached "LCD.vi" works great. However, I want the LCD to be continuously updated, so I put in a while loop that loops every second. Suddenly, it doesn't work anymore. Well, the first iteration works, but if you change the values in labview while the program is running, the LCD does not update with new values. I'm not sure what's going on. I attached the "LCD_loop.vi" as well. Does anyone have any ideas?

Download All
0 Kudos
Message 1 of 4
(4,203 Views)

I'm guessing it is because you are initializing the LCD every time that you call that function (so, the second time you send the command, it already exists).  You will probably need to have at least three custom functions work with the LCD:

  • Open
  • Do stuff
  • Close (you might not need this one but if the library has a release/close/shutdown function, you would use it here)
0 Kudos
Message 2 of 4
(3,676 Views)

Nathan_B. wrote:

I'm guessing it is because you are initializing the LCD every time that you call that function

Doh! I knew I was missing something easy. I'm going to re-write the my switch-case tonight and add a couple new cases to handle the lcd.init(), lcd backlight and contrast settings, setCursor(), and finally lcd.print(). Then I can initialize the LCD and set backlight and contrast only once from Labview and not have it hard-coded. Thanks for your help! Sometimes you just need a second pair of eyes, especially after a 7 hour long coding marathon.

0 Kudos
Message 3 of 4
(3,676 Views)

I know how those "coding marathons" can make things hide in plain sight easily .

0 Kudos
Message 4 of 4
(3,676 Views)