T19
void main()
{
unsigned long int voltage;
unsigned char v1,v2,v3;
TRISA=0xFF;
TRISC=0;
Lcd_Init(&PORTC);
Lcd_Cmd(LCD_CURSOR_OFF);
Lcd_Cmd(LCD_CLEAR);
while(1)
{
Lcd_Cmd(LCD_CLEAR);
voltage=Adc_Read(3);
voltage=voltage*489/1000;
v1=voltage/100;
v2=(voltage%100)/10;
v3=voltage%10;
Lcd_Chr(1,1,v1+48);
Lcd_Chr(1,2,'.');
Lcd_Chr(1,3,v2+48);
Lcd_Chr(1,4,v3+48);
Lcd_Chr(1,5,' ');
Lcd_Chr(1,6,'v');
delay_ms(500);
}
}
ความคิดเห็น
แสดงความคิดเห็น