EmbDev.net

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


Author: Andrew Bb (asterx)
Posted on:

Rate this post
0 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?

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.