AnsweredAssumed Answered

i have a problem with the timer would any one help me

Question asked by mohamed on Jul 24, 2009
Latest reply on Jul 24, 2009 by mohamed

i am working on ADSP-TS201  and i was just checking the operation of the timer as i will need it in a certain application and i write this code and checked the assembly language in the assemble everything is okay but  i still don't know why it doeasn't work

 

/*****************************************************************************
* testing.c
**************************************************************************/


#include<sysreg.h>                                                           

#include<stdio.h>
#include<defts201.h>                              

#include<builtins.h>

 

#define SYSREG_CLR(sysreg,bit) __builtin_sysreg_write(sysreg, __builtin_sysreg_read(sysreg)&~bit)   //macro used to clear the bits
#define SYSREG_SET(sysreg,bit) __builtin_sysreg_write(sysreg, __builtin_sysreg_read(sysreg)|bit)  
//macro used to set bits


int main(void)          
{
unsigned int t;
unsigned int x;
int i;

__builtin_sysreg_write(__INTCTL,0x00000000);               // disable the timer

__builtin_sysreg_write(__TMRIN0H,0x0FFFFFFF);          // load the timer by this value

SYSREG_SET(__INTCTL, INTCTL_TMR0RN);                //run the timer and i checked that the bit was sit in the assembly code
  
for(i=0;i<=100;i++)
{
 
  t= __builtin_sysreg_read(__TIMER0H);                          // the value of t should be derementing each clock cycle(300 MHZ)
  printf("t= %d\n",t);
}


return(0);
}
  

 

thank you for your time

Outcomes