Reply by Alex Bluett April 18, 20042004-04-18
Hi, i was wondering if anyone could help me. I have modified the
timer interrupt example that came with code composer
studio, so that the prd register that sets the timer period can be
modified by certain variables in the task function. Also i have
changed the set up of the ISR so that the timer doesnt actually
start and stop in it, so that the whole thing runs in real time
rather than starting and stopping every time the ISR is called. For
some reason this doesnt work, what ever i set the prd to, the output
is always the same (Not time dependant), the calling of the ISR
doesnt seem to change. Does anyone know why this is. In doing this
do i need to change the timer structure? If it helps, the use of
this is to create and output a realtime sine wave with the frequency
of the sinewave being dependant on what the prd register is set to.

The modifications to the task function is something like (changed it
about so many times):

/* Open Timer 0, this returns a pointer to a Timer Handle */
/* that will be used as an argument to other CSL functions */
mhTimer = TIMER_open(TIMER_DEV0, TIMER_OPEN_RESET);
printf("Initial\n");
TIMER_getConfig(mhTimer,&myTConfig);
printf("TIMERCONFIG TCR:%x PRD:%x\n",myTConfig.tcr,
myTConfig.prd);

/* Write configuration structure values to Timer control */
/* registers. */
// myTConfig.prd=timer_period;
myTConfig.prd=0x0000u;
TIMER_config(mhTimer, &myTConfig);
printf("After setting\n");
TIMER_getConfig(mhTimer,&myTConfig);
printf("TIMERCONFIG TCR:%x PRD:%x\n",myTConfig.tcr,
myTConfig.prd);

If anymore information is needed let me know. Would appreciate any help. Thanks for your time, Alex Bluett.