1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice
Hajaaar

program of a barometer

pressure

  1. Hajaaar
    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;

    unsigned long valeur,val;
    unsigned char d1, d2, d3, d4,*text;
    char i ;
    void main() {

    ADCON0=0x48;
    ADCON1=0x80;
    TRISA=0xff;
    trisd=0xff;
    Lcd_init();
    Lcd_Cmd(_Lcd_CURSOR_OFF);



    for(;;) {

    text = ("pression");
    Lcd_Out(1, 1, text);
    val=Adc_Read(1);

    text = ("pression");
    Lcd_Out(1, 1, text);
    val=Adc_Read(1);
    val=val*5000/1023;
    d1= val/1000;
    d2=( val%1000)/100;
    d3=(( val%1000)%100)/10;
    d4=(( val%1000)%100)%10;
    PORTD.B1=1;
    lcd_chr(2,8,d1+48);
    lcd_chr_cp(d2+48);
    lcd_chr_cp('.');
    lcd_chr_cp(d3+48);
    lcd_chr_cp(d4+48);
    lcd_out_cp(" Pa");
    Lcd_Cmd(_Lcd_CURSOR_OFF);

    }}
    Please I need to understand what makes this program
    Thanks