100% found this document useful (1 vote)
23 views

Adc Value Display On LCD

This document defines pins for an LCD display and reads analog voltage values from an ADC. It initializes the LCD, displays some text, reads an analog value with the ADC, converts it to a voltage, calculates the voltage value digits, displays the voltage on the LCD, and repeats in a loop.

Uploaded by

onepointer
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
23 views

Adc Value Display On LCD

This document defines pins for an LCD display and reads analog voltage values from an ADC. It initializes the LCD, displays some text, reads an analog value with the ADC, converts it to a voltage, calculates the voltage value digits, displays the voltage on the LCD, and repeats in a loop.

Uploaded by

onepointer
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

sbit lcd_rs at rb2_bit; sbit lcd_en at rb3_bit; sbit lcd_d7 at rb7_bit; sbit lcd_d6 at rb6_bit; sbit lcd_d5 at rb5_bit;

sbit lcd_d4 at rb4_bit; //LCD: direccionamiento de pines sbit lcd_rs_direction at trisb2_bit; sbit lcd_en_direction at trisb3_bit; sbit lcd_d7_direction at trisb7_bit; sbit lcd_d6_direction at trisb6_bit; sbit lcd_d5_direction at trisb5_bit; sbit lcd_d4_direction at trisb4_bit; unsigned long adc_value; unsigned char d1,d2,d3,d4; #define printV lcd_chr(2,11,48+d1); lcd_chr_cp('.'); lcd_chr_cp(48+d4); lcd_chr_cp(d2+48); lcd_chr_cp(48+d3); lcd_chr_cp('V'); \ \

#define calcV

d1=adc_value/1000; d3=((adc_Value%1000)%100)/10;

d2=(adc_value%1000)/100; \ d4=((adc_value%1000)%100)%10;

void main() { ADCON1=0b10000010; TRISA=0XFF; Lcd_Init(); lcd_cmd(_LCD_CLEAR); lcd_cmd(_LCD_CURSOR_OFF); Lcd_Out(1,2,"KEYPAD PRESSURE"); lcd_out(2,1,"CALCULATOR:"); for(;;){ adc_value=ADC_Read(0); adc_value=adc_value*5000/1023; calcV printV delay_ms(20); } }

You might also like