This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Interfacing ADC0804 with 8051

Please provide assembly language code for interfacing Adc0804 with 8051

Parents
  • hi friend i post u my working program which is in c language & as well as in asembly.......

    #include<reg51.h>
    #define input P0 //Input port to read the values of ADc
    #define output P2 // Output port, connected to LED's.

    sbit wr= P1^1; // Write pin. It is used to start the conversion.
    sbit rd= P1^0; // Read pin. It is used to extract the data from internal register to the output pins of ADC.
    sbit intr= P1^2; // Interrupt pin. This is used to indicate the end of conversion. It goes low when conversion is complete.

    void delay(unsigned int msec ) // The delay function provides delay in msec.
    { int i,j ;
    for(i=0;i<msec;i++) for(j=0; j<1275; j++);
    }

    void adc() // Function to read the values from ADC and display on the LED's.
    { rd=1;
    wr=0;
    delay(1);
    wr=1;
    while(intr==1);
    rd=0;
    output=input;
    delay(1);
    intr=1;
    } void main()
    { input=0xff; // Declare port 0 as input port.
    while(1)
    { adc(); }
    }

    asembaly language programing

    RD Bit p3.5
    wr Bit p3.6
    INTR Bit P3.7

    again: mov p1,#0ffh //configure as i/p port to get 8 bit converted data

    mov p0,#00h //configure as o/p port to display our data

    clr WR

    setb wr // give low to hige pulse for start convertion

    back:jb INTR,back // wait for convertion takes place

    clr RD // to get deta converted

    mov a,P1

    mov p0,a // write your rutin for display data

    setb RD

    sjmp again

    end

    plz send me hardware diagram for this bcoz i am littel confused with this

Reply
  • hi friend i post u my working program which is in c language & as well as in asembly.......

    #include<reg51.h>
    #define input P0 //Input port to read the values of ADc
    #define output P2 // Output port, connected to LED's.

    sbit wr= P1^1; // Write pin. It is used to start the conversion.
    sbit rd= P1^0; // Read pin. It is used to extract the data from internal register to the output pins of ADC.
    sbit intr= P1^2; // Interrupt pin. This is used to indicate the end of conversion. It goes low when conversion is complete.

    void delay(unsigned int msec ) // The delay function provides delay in msec.
    { int i,j ;
    for(i=0;i<msec;i++) for(j=0; j<1275; j++);
    }

    void adc() // Function to read the values from ADC and display on the LED's.
    { rd=1;
    wr=0;
    delay(1);
    wr=1;
    while(intr==1);
    rd=0;
    output=input;
    delay(1);
    intr=1;
    } void main()
    { input=0xff; // Declare port 0 as input port.
    while(1)
    { adc(); }
    }

    asembaly language programing

    RD Bit p3.5
    wr Bit p3.6
    INTR Bit P3.7

    again: mov p1,#0ffh //configure as i/p port to get 8 bit converted data

    mov p0,#00h //configure as o/p port to display our data

    clr WR

    setb wr // give low to hige pulse for start convertion

    back:jb INTR,back // wait for convertion takes place

    clr RD // to get deta converted

    mov a,P1

    mov p0,a // write your rutin for display data

    setb RD

    sjmp again

    end

    plz send me hardware diagram for this bcoz i am littel confused with this

Children
No data