romel_emperado
Advanced Member level 2
- Joined
- Jul 23, 2009
- Messages
- 606
- Helped
- 45
- Reputation
- 132
- Reaction score
- 65
- Trophy points
- 1,318
- Location
- philippines
- Activity points
- 6,061
guys. I need help how to display exactly what is the input in the ADC to LCD.
what i have now is the adc binary value is directly displayed in the LCD.
my ADC input is 5v and I want to display ov to 5v in the LCd.. but i dont know how to write a code for that..
protues file and hex file attached..
my compiler is mikroC
pls check my code
what i have now is the adc binary value is directly displayed in the LCD.
my ADC input is 5v and I want to display ov to 5v in the LCd.. but i dont know how to write a code for that..
protues file and hex file attached..
my compiler is mikroC
pls check my code
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 // LCD module connections sbit LCD_RS at RB4_bit; sbit LCD_EN at RB5_bit; sbit LCD_D4 at RB0_bit; sbit LCD_D5 at RB1_bit; sbit LCD_D6 at RB2_bit; sbit LCD_D7 at RB3_bit; sbit LCD_RS_Direction at TRISB4_bit; sbit LCD_EN_Direction at TRISB5_bit; sbit LCD_D4_Direction at TRISB0_bit; sbit LCD_D5_Direction at TRISB1_bit; sbit LCD_D6_Direction at TRISB2_bit; sbit LCD_D7_Direction at TRISB3_bit; void main() { unsigned int temp_ADCresult,volt; char txt[8]; TRISC = 0x00; // set direction to be output PORTC = 0x00; //LCD config Lcd_Init(); // Initialize LCD Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off do { temp_ADCresult = ADC_Read(2);// Get 10-bit results of AD conversion PORTC = temp_ADCresult;//result from ADC volt = temp_ADCresult; IntToStr(volt, txt); Lcd_Out(1,2, txt); } while(1); // Endless loop }
Attachments
Last edited: