Display voltage and digital value on LCD Electronics

  • img
Project Details

Here’s a brief project that shows how to display both the analog voltage and digital value on the LCD. To display the measured voltage and digital conversion, we will use a 16x2 LCD display which are very popularly used for hobbyist’s projects.

LCD pinsCloudX pins
VSSGND
VDD5V
VEE (through 1k resistor)GND
RSP1
RWGND
EP2
D4P3
D5P4
D6P5
D7P6
LED A5V
LED KGND

 

 

Code

#include <CloudX\M633.h>
#include <CloudX\stdlib.h>
#include <CloudX\ADC.h>
#include <CloudX\LCD.h>


float readings; 
char *displayText; 

setup(){ 
          //setup here 
          Analog_setting(); 
          LCD_setting(1,2,3,4,5,6); 
          LCD_cmd(clear); 
          LCD_cmd(cursorOff); 

loop(){ 
          //Program here 
          readings = Analog_read(0);             //Taking digital readings 
          LCD_writeText(1,1,"Digital: ");        
          intTostr(displayText, readings, DEC);  //convert integer reading to text 
          displayText[4]=0;                      //convert to 4 reading text 
          LCD_writeTextCP(displayText);          //display on LCD 
           
          readings = readings* 5/1023;           //convert the digital reading to analog 
          LCD_writeText(2,1,"Analog: ");      
          displayText = floatTostr(readings);   // convert reading to text 
          displayText[5]=0;   
          LCD_writeTextCP(displayText); 
          delay(2000); 
          LCD_cmd(clear); 
           
     } 
}  

Share this with friends