Вы находитесь на странице: 1из 9

Digital Signal Processing

with DSK6713

EE433
Session 12 4th May 2009 Department of Electrical Engineering

Air University

Todays Agenda

Introduction to timer / counter Using the timer on DSP C6713

Timer / Counter

Most of the embedded systems (microcontrollers, DSPs, etc.) have built-in timers / counters. These are hardware modules usually comprised of T flip flops. These modules can take clock frequency from outside or inside of the chip. When clock frequency is fed from outside, it is called counter. When the clock is given from inside, it is timer.

Timer / Counter

When you like to run a certain function after a specific time interval, you configure this module as timer. It is very much similar to a timer in a washing machine. You set the timer at a value after which you like to stop the machine automatically. If you like to count the number of pulses generated by some external hardware, you configure the same module as counter and it counts the number of pulses received at a particular pin of the chip. It is very much similar to the counter in ATM machine. If you enter your PIN wrong three times, it captures your card. There is a counter inside, that counts your wrong entries for PIN.

Timer / Counter

Apparently a T flip flop behaves as counter. If you cascade 4 flip flops you can count from 0 to 15. If 6 flip flops are cascaded you can count up to 26 -1 (=63).

Then how a counter becomes a timer when clock is generated internally? Its just an interpretation. When the clock is generated internally you know the frequency. When you set counter / timer for a certain target value you can easily determine, how long will it take to reach that target value.

Timer Example

We like to light a LED after 10 ms. The timer is 16-bit (16 flip flops cascaded) and the internal clock frequency is 1 MHz. The real problem is that how the processor or controller will know that 10 milliseconds have passed away. If we set the target count as 10000, the timer will generate an interrupt when its value equals 10000. The time taken to count up to 10000 = Count Value = 10000 6

f CLK

1 10

= 10 ms

If we have configured the timer to generate an interrupt when it reaches the target count, it will generate interrupt after exact 10 ms. At the interrupt, the processor will know that now its time to light the LED.

Timer Module on DSP C6713

DSP TMS320C6713 has two timer modules, each 32-bits, Timer 0 and Timer 1. Timer 0 is reserved for the processor itself. Timer 1 is available to the system designer. Timer module can be configured to take clock internally or externally. C6713 operates on clock frequency 225 MHz. Timer module can be configured to take one-fourth or one-eighth of this frequency as input. The target values of timer can be set from 1 to 232-1( 4.3 x 109).

Example Problem

How will you configure timer 1 of the DSP C6713 if you want to generate interrupt after 100 ms. fCLK = ________ (options: 225/4 MHz, 225/8 MHz)
Target count = _________ (options: 1 to 232-1)

Announcements

Next Monday you may have a quiz. Final viva has been scheduled next week. Date and time will be announced shortly. The last two assignments are due on 12th May 2009 (FIR filter assignment and todays assignment). Distribution of marks for DSP lab is as under. Assignments: Quiz: Practical Exam: Final Viva: 10 2.5 2.5 5

Вам также может понравиться