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

How to resolve the contention between 2 ADC0801!!!???

How to resolve the contention between 2 ADC0801!!!???

I would like using two ADC0801 in order to read 2 Vol electric signal ., 2 ADC interfaces with AT89c51 by using common input..If I use an ADC, no problem, but with 2 ADC ,ADC will not working!!!! Please help me!!!

My programmer and file Proteus is below

www.MegaShare.com/512261

Parents Reply Children
  • To my knowledge, the /INTR signal is not tristate, so you can not directly connect two /INTR outputs to a single interrupt pin on your processor.

    You either have to connect them using a AND gate (any /INTR going low will drive the output of the AND low) or connect them to two separate inputs of the processor.

    The problem with letting them feed the same interrupt is that you will not know which ADC that is ready to be serviced (unless you only started one conversion).

    This is a big reason for using an external analog multiplexer, or an ADC with multiple inputs. Then you have _one_ ADC that will issue an interrupt, and you will always know which signal that is currently multiplexed into the ADC or which channel of the ADC that you requested to perform a conversion.

  • In my progam:
    i use 2 button to control 2 ADC.each ADC have each pin INTR to connect 2 separate input pin of the processor..so why d'ont INTR pin of ADC work,after converted...this thing cause ADC can't be read by processor

  • Problem with an interrupt signal only affects how you will know that a conversion is done - it does not affect your ability to talk with the ADC.

  • when I remove ADC2 in my circuit(proteus),ADC1,processor run as normal
    When i remove ADC1,then ADC2 also does not work...Why??There is only ADC1 work actually
    if all 2 ADC connect in circuit,When I press any buttons,,chip does not work...see here.www.mediafire.com/

  • "Problem with an interrupt signal only affects how you will know that a conversion is done - it does not affect your ability to talk with the ADC"

    i understand this thing.My mean:i use button to allow operate ADC,star convert,,then wait signal INTR from ADC send to CHIp to alert "finish start convert",after chip will read ADC then show in leg7seg...is this right??

    my code use for operating ADC

    if(button1==1){
    CS_1=0;
    WR_1=0;
    WR_1=1;
    while (INTR_1==1);//wait for signal INRT_1...cho den khi co tin hieu ngat tu ADC
    CS_1=0;
    RD_1=0;
    //CS_1=1 not write here khong the dat o day...dan toi ko doc duoc
    }

  • ... you need to post them in a format people can read.

    Unfortunately, as far as I know, there is no universal schematic format - so you will have to export it to something like GIF or PDF.

    Note that JPEG is not (generally) a good choice for schematics...

  • "When i remove ADC1,then ADC2 also does not work...Why??"

    That's for you to find out!

    You have the hardware there - what investigations have you done?

    Do you have an oscilloscope?

  • "You have the hardware there - what investigations have you done?"
    i d'ont have hardware, i have just only stimulate my circuit with Software proteus 7.2,and program with keil c,

    "Unfortunately, as far as I know, there is no universal schematic format - so you will have to export it to something like GIF or PDF."

    i imported my circuit to file format bitmap..,first ,start testing my circuit here....www.mediafire.com/

    alert me when link die!!!!

  • In that case, use whatever facilities your simulator provides as it's simulated equivalent of probing with an Oscilloscope.

    For help in how to use your simulator, you're going to have to go to their site - it's not a Keil product.
    Do they have a forum?

  • i have already debuged my code C with Keil,run as normal,but it can't stimulate with PROTEUS, ,so i will write my code here,,help me to test my code please!!

    this program use each button to read each ADC
    //button1=P2_6
    //button2=P2_7

    #include <REGX51.H>
    sbit ledD0=P0^0;
    sbit ledD1=P0^1;
    sbit ledD2=P0^2;
    sbit ledD3=P0^3;
    sbit ledD4=P0^4;
    sbit ledD5=P0^5;
    sbit ledD6=P0^6;
    sbit LED_0=P2^0; //hang don vi
    sbit LED_1=P2^1; //hang chuc
    sbit LED_2=P2^2; //hang tram
    sbit INTR_1=P3^2;//INTR0 of CHIP
    sbit INTR_2=P3^3;//INTR1 of CHIP
    sbit CS_1=P3^4;
    sbit CS_2=P3^5;
    long n;
    int a,b,c;
    void delay(long time)
    { for(n=0; n<time; n++)
    { ;
    } }
    void bit_dec()
    { c=P1%10;//hang don vi
    b=((P1-c)/10)%10;//hang chuc
    a=((((P1-c)/10)-b)/10)%10; //hang tram
    } unsigned char x;
    void Hienthiled(x) // Co 1 bien dau vao de xac dinh xem la hien thi so nao
    { int arr[]={64,121,36,48,25,18,2,120,0,16} ; P0 = arr[x]; }
    void inhangtram()
    { LED_2=0;
    LED_1=LED_0=1;
    Hienthiled(a);
    } void inhangchuc()
    { LED_1=0;
    LED_0=LED_2=1;
    Hienthiled(b);
    } void inhangdonvi()
    { LED_0=0;
    LED_1=LED_2=1;
    Hienthiled(c);
    } void laymauADC1()
    { //convert voi ADC1
    CS_1=0; //Make CS low
    RD=1;
    WR=0;
    WR=1;
    CS_1=1;
    while(INTR_1==1);
    //Read ADC
    CS_1=0; //Make CS low
    RD = 0; //Make RD low
    RD = 1; //Make RD high
    CS_1=1; //Make CS high
    } void laymauADC2()
    { //convert voi ADC2
    CS_2=0; //Make CS low
    RD=1;
    WR=0;
    WR=1;
    CS_2=1;
    while(INTR_2==1);
    //Read ADC
    CS_2=0; //Make CS low
    RD = 0; //Make RD low
    RD = 1; //Make RD high
    CS_2=1; //Make CS high
    } void phimbam()
    { if(P2_6==0){laymauADC1();}
    else if(P2_7==0){laymauADC2();}
    } void main(void)
    { while(1) { WR=1;// chuyen doi lai RD=1;// xoa gia tri da doc truoc do phimbam(); bit_dec(); inhangtram(); delay(3000); inhangchuc(); delay(3000); inhangdonvi(); delay(3000); }
    }

    if you want to see schema you can see here
    www.mediafire.com/

  • Please read the instructions on how to post source code - they are really quite clearly stated:
    www.danlhenry.com/.../keil_code.png

    Note that TABs don't work (well) - use spaces instead,

    and don't forget to check it in the 'Preview'...

    If you can miss such obvious details when just posting on a forum, you're going to have reall difficulties with embedded development...

  • wow! cool! remarks in mandarin (I think) !