EmbDev.net

Forum: ARM programming with GCC/GNU tools Timers reload in ADuC7128


von Andrew B. (asterx)


Rate this post
useful
not useful
Anybody knows how to reload timers in ADuC7128?

It is written in datasheet to write TxICLR register, but when I'm using
this code:


#include "ADuC7128.H"
#include "rs232.h"

#define LED_LOW    GP0CLR = 0x00400000
#define LED_HI    GP0SET = 0x00400000

void peripheryInit(void)
{
  GP0CON = 0;
  GP0DAT |= 0x40000000;     // LED -> OUTPUT
}

int main(void)
{
  unsigned int T1VAL_prev;

  POWKEY1 = 0x01;
  POWCON &= ~0x03;
  POWKEY2 = 0xf4;
  ConfigUART115200();
  peripheryInit();

  T1CON = 0x03cf;
  T1LD = 1;

  for(;;)
  {
    if(T1VAL_prev != T1VAL)
    {
      T1VAL_prev = T1VAL;
      while(!(0x040==(COM0STA0 & 0x040)));
      COM0TX = T1VAL;

      if(T1VAL >= 5)
      {
        T1ICLR = 1;
        LED_LOW;
      }
      else
        LED_HI;
    }
  }
}


... I get values: ... 3, 4, 5, 6, 7, ... - so timer is not reload (when
T1VAL >= 5).
Do I make any mistake?

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.