Interfacing Of At89c51 With Adc0804

Discussion in 'Embedded Systems and Microcontrollers' started by srinivasinc2003, Nov 15, 2006.

  1. srinivasinc2003

    Thread Starter New Member

    Nov 15, 2006
    1
    0
    Please tell how to read ADC0804.

    I m not able to get output in second programme at PORT2 ? Please help me.

    /* PORT1 is interfaced with 8-bit output of ADC0804.


    main()
    {
    while(1)
    {
    P2=P1;
    }
    }


    main()
    {
    while(1)
    {
    if(P1<80)
    P2=P1;
    else
    P2=0;
    }
    }
     
  2. sci-3d

    Well-Known Member

    Aug 22, 2006
    51
    0
    I don't know it may be if(P1<0x80) or P2=0x00;. I guess.
     
  3. itspider

    New Member

    Nov 4, 2006
    6
    0
    ORG 00H
    ;P3.4 <-->WR(to start convert analog - binary (0804)we must have WR 0->1)
    ;P3.5 <-->INTR (=0 to and convert)
    ;P3.3 <-->RD (RD 1->0 to read data from ADC)
    ;P2 <-->D0-D7 (out put)
    ;-----------------------------------------------------------;
    MOV P1,#0FFH ; to receive data from ADC
    BACK:
    CLR P3.4 ; WR =0
    SETB P3.4 ; dat WR = 1 to start convert
    HERE:
    JB P3.5,HERE ; wait to end convert
    CLR P3.3 ; end convert and allow read data form ADC
    MOV A,P1 ; read data onto A register
    ACALL CONV_ASC ; convert to ASCII and display
    ACALL DISPLAY ; on LCD
    SETB P3.3 ; dat RD=1 for read next steps
    SJMP HERE ;
    ;-----------------------------------------------------------;
    END
     
  4. saha

    Well-Known Member

    Jun 1, 2006
    53
    0
    hello itspider,
    I'd heard abt HO CHI Minh. BUT COULD YOU TELL ME WHAT THE FOLLOWING LINE MEANS, PLS EXPLAIN IN ENGLISH.

    Không có việc gì khó.
    Chỉ sọ lòng không bền
    ...
    "Ho Chi Minh"
    Reply With Quote
     
  5. praveen_cpp

    New Member

    Dec 2, 2006
    4
    0
    #define ADC_Data P1
    #define ADC_RD P3.3
    #define ADC_WR P3.4


    unsigned char Read_ADC(void)
    {
    ADC_WR = 0;
    ADC_RD = 1;
    ADC_WR = 1;
    DELAY();
    ADC_RD = 0;
    return ADC_Data ;
    }


    vid main()
    {

    while(1)
    {
    P2 = Read_ADC();
    }

    }
     
  6. nguyenvandai

    New Member

    Dec 3, 2006
    2
    0
    May la thang nao ma mat day the ?
     
  7. Mohammad

    New Member

    Jan 4, 2007
    1
    1
    hi
    i m new here but i may can help you , i make a project of how to convet analog signal to digital using ( at89c51 , adc0804 ) and display the result into 7-segment the program is in assemply and it works good
    if you interested i will send you the project.
     
    firend likes this.
  8. tayyab03

    New Member

    Feb 4, 2008
    3
    0
    well i am having problems interfacing with microcontroller we are using adc0804 in free running mode ... while we sending ff at the p1 port ... all the pins of adc gets high .. so it dont deliver the data of its on towards the port1 of 89c51
    plz help .. what can i do
     
  9. Papabravo

    Expert

    Feb 24, 2006
    9,905
    1,723
    Clearly you have not connected and managed the ADC0804 control signals properly.

    You need to activate Chip Select and Write to start a conversion.

    You need to activate Chip Select and Read to read the result.

    You need to carefully read the datasheet
    http://cache.national.com/ds/DC/ADC0801.pdf

    Chip Select (CS) is pin 1
    Read (RD) is pin 2
    Write(WR) is pin 3

    Please check out the timing diagram on page 6 for starting conversion.
    Please check out the timing diagram on page 7 for reading the result.
    Please check out page 23, section 2.8 for free running mode. Did you momentarily force WR and INTR low after power up?

    This is really an easy chip to work with.
     
  10. tayyab03

    New Member

    Feb 4, 2008
    3
    0
    now what i have done is

    p3.6 (WR)
    p3.7 (RD)
    p3.2 (INTR)
    p1 (D0-D7)




    org oh

    mov p1,0#0ff
    back: clr p3.6
    setb p3.6
    here: jb p3.2,here
    clr p3.7
    mov a,p1
    setb p3.7
    sjmp back
    end


    still its not working i dont have any idea y now it have to work can any one help ....
     
  11. Papabravo

    Expert

    Feb 24, 2006
    9,905
    1,723
    Don't you need a chip select line?
    Is 0xFF the command you need to start a conversion? Why do you not do this command on the subsequent conversions.
     
Loading...