seankuay
Guest
|
Posted:
Mon Dec 12, 2005 8:45 am Post subject:
Timer Usage in TMS320vc5510 |
|
|
Hi,
I am currently trying the timer block of the tsm320vc5510. I have som
doubt on the timer counting mechanism. Below is the code:
asm(" mov #0,port(#0x2403)"); //timer0 prescale register
asm(" mov #0xffff,port(#0x2401)");//timer0 PRD period reg
//0~~~~~~~~~~~~~~~ IDLEEN 0 = do not idle with Peripheral Domain
//~0~~~~~~~~~~~~~~ INTEXT n/a
//~~0~~~~~~~~~~~~~ ERR_TIM 1 = if illegal function change occurs
//~~~00~~~~~~~~~~~ FUNC 00 = TIN/TOUT pin in high impedance. the 5510ds
already connect this 2 pin to 3.3v, don't drive it as output (coz ma
spoint the pin)
//~~~~~1~~~~~~~~~~ TLB 1 = loading from period registers
//~~~~~~0~~~~~~~~~ SOFT n/a
//~~~~~~~0~~~~~~~~ FREE 1 = Timer doesn’t stop on emulation halt
//~~~~~~~~00~~~~~~ PWID n/a
//~~~~~~~~~~1~~~~~ ARB 0 = auto-reload disabled - will stop once reac
tim=0
//~~~~~~~~~~~1~~~~ TSS 1 = stop timer
//~~~~~~~~~~~~1~~~ CP 0 = pulse mode, 1=clock (toggle) mode
//~~~~~~~~~~~~~0~~ POLAR 0 = normal polarity
//~~~~~~~~~~~~~~0~ DATOUT n/a
//~~~~~~~~~~~~~~~0 Reserved
asm(" mov #0000010000111000b, port(#0x2402)");//loading - timer ctr
reg
asm(" mov #0000000000101000b, port(#0x2402)"); //start - timer ctr
reg
//7 nops
asm(" nop");
asm(" nop");
asm(" nop");
asm(" nop");
asm(" nop");
asm(" nop");
asm(" nop"); //1 timer count
asm(" mov port(#0x2400),AR0");//this instruction is 8 timer coun
(internal clock)
asm(" nop");
As shown above, i set the prescaler to 0 and main timer PRD as 0xffff. Th
next instruction is to load the respective TIM and PSC registers in th
timer. Then i start the timer.
My doubt is why i need to add 7 NOPs in between before i can read properl
the value 0xfffe to the AR0 register? If i take away the 7 NOPs, the time
value shown at AR0 is still 0xfffe. If i have 8 NOPs, then the AR0 show
timer reading of 0xfffd, and start decrementing with additional NOPs.
may i know why is this happening? Also why the instruction mo
port(#0x2400),AR0 takes 8 timer count value? what i saw from the cod
composer view clock profiler is that it only takes 1 cycle to perform tha
instruction?
really thanks for you guys help. |
|