Le cahier de charge
Réaliser un voltmètre simple qui mesure le ddp entre deux point et qui affiche cette tension sur un afficheur lcd
Le code en mikroc:
sbit LCD_RS at RD4_bit;
sbit LCD_EN at RD5_bit;
sbit LCD_D4 at RD0_bit;
sbit LCD_D5 at RD1_bit;
sbit LCD_D6 at RD2_bit;
sbit LCD_D7 at RD3_bit;
sbit LCD_RS_Direction at TRISD4_bit;
sbit LCD_EN_Direction at TRISD5_bit;
sbit LCD_D4_Direction at TRISD0_bit;
sbit LCD_D5_Direction at TRISD1_bit;
sbit LCD_D6_Direction at TRISD2_bit;
sbit LCD_D7_Direction at TRISD3_bit;
// End LCD module connections
float volt1=0X00;
float volt2=0X00;
char voltage[4];
void initialisation(){
lcd_init();
lcd_cmd(_lcd_clear);
lcd_cmd(_lcd_cursor_off);
lcd_out(1,1,"La Tension");
adc_init();
portd=0X00;
porta=0X00;
trisa=0xFF;
trisd=0X00;
}
void main() {
initialisation();
while(1){
volt1=adc_read(0);
volt2=adc_read(1);
volt1-=volt2;
volt1*=0.00489;
floattostr(volt1,voltage);
lcd_out(2,1,voltage);
}
}
le circuit
Réaliser un voltmètre simple qui mesure le ddp entre deux point et qui affiche cette tension sur un afficheur lcd
Le code en mikroc:
sbit LCD_RS at RD4_bit;
sbit LCD_EN at RD5_bit;
sbit LCD_D4 at RD0_bit;
sbit LCD_D5 at RD1_bit;
sbit LCD_D6 at RD2_bit;
sbit LCD_D7 at RD3_bit;
sbit LCD_RS_Direction at TRISD4_bit;
sbit LCD_EN_Direction at TRISD5_bit;
sbit LCD_D4_Direction at TRISD0_bit;
sbit LCD_D5_Direction at TRISD1_bit;
sbit LCD_D6_Direction at TRISD2_bit;
sbit LCD_D7_Direction at TRISD3_bit;
// End LCD module connections
float volt1=0X00;
float volt2=0X00;
char voltage[4];
void initialisation(){
lcd_init();
lcd_cmd(_lcd_clear);
lcd_cmd(_lcd_cursor_off);
lcd_out(1,1,"La Tension");
adc_init();
portd=0X00;
porta=0X00;
trisa=0xFF;
trisd=0X00;
}
void main() {
initialisation();
while(1){
volt1=adc_read(0);
volt2=adc_read(1);
volt1-=volt2;
volt1*=0.00489;
floattostr(volt1,voltage);
lcd_out(2,1,voltage);
}
}
le circuit
bonjour,
RépondreSupprimercomment je peux recevoir ces lectures sur un telephone sous forme d'sms????et merci d'avance :))