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

ATMEL T89C51CC01 PSIDLE mode problems...

Hello !!

I've following problem: I use a ATMEL T89C51CC01 Mcu with the Keil C51 c-compiler/simulator. When I use the ADC in pseudo idle mode (I set PSIDLE bit) the MCU doesn't wake up any more (although the ADEOC flag occurs !! and all other bits are set (EA,EADC,Priority highest and also tested lowest)).
Until now I've tested the software only on the simulator...
Has anybody an idea, what the problem might be ??
thx for your help,
florian mair.
P.s.: using the idle mode of the PCON sfr (IDL bit) the Mcu wakes up again ...

Parents
  • I'm sorry that it turned up to you that I'm not interrested in your suggestion, (that's not at all) but you suggested me to read the bytes in reverse order but I'm not even be able to read a byte...

    here is the exact situation / code:
    (gadc_b is a global bit)

    this is my ADC interrupt routine:

    void Adc_int_(void) interrupt ADC_INT {
    ADEOCOFF; //sets ADEOC = 0
    gadc_b = 1;
    }

    this is my routine:
    (sfr status: EA = 1, EADC = 1;ADEN =1;)

    gadc_b = 0;
    ADCON &= 0x78; //Pin 0
    PSIDLEON; //sets PSIDLE
    ADSSTON; //sets ADSST
    while (gadc_b == 0){ //waiting till interrupt occours...
    ; //here the ADEOC flag gets set by hardware but nothing happens.. (when I don't set the PSIDLE bit everything works...)
    }

    thx for your help,
    florian.

Reply
  • I'm sorry that it turned up to you that I'm not interrested in your suggestion, (that's not at all) but you suggested me to read the bytes in reverse order but I'm not even be able to read a byte...

    here is the exact situation / code:
    (gadc_b is a global bit)

    this is my ADC interrupt routine:

    void Adc_int_(void) interrupt ADC_INT {
    ADEOCOFF; //sets ADEOC = 0
    gadc_b = 1;
    }

    this is my routine:
    (sfr status: EA = 1, EADC = 1;ADEN =1;)

    gadc_b = 0;
    ADCON &= 0x78; //Pin 0
    PSIDLEON; //sets PSIDLE
    ADSSTON; //sets ADSST
    while (gadc_b == 0){ //waiting till interrupt occours...
    ; //here the ADEOC flag gets set by hardware but nothing happens.. (when I don't set the PSIDLE bit everything works...)
    }

    thx for your help,
    florian.

Children
  • I can see a possible problem. The micro goto to sleep before the ADSSTON line executes. I would goto to sleep, start the conversion and clear the last end of conversion flag, all in one statement. In this case the ISR does not need to do anything.

    void Adc_int_(void) interrupt ADC_INT
    {
    }
    
    WORD ReadAdc( BYTE Channel )
    {
      ADCON = 0x48 | Channel; //= PSIDLE | ADSST | ~ADEOC
      //the only way to get to this line is for the conversion to be completed
      return( ADDH << 8 | ADDL );
    }
    

  • Dear Mr. Young !

    Now we have it !

    It was a fault of the Simulator Version 2.14. I've updated it to Version 2.20a and now it works fine....

    thx for your help again,
    florian.