Timers are basic peripherals of each microcontroller. Depending upon the model, the dsPIC30F family offers several 16-bit timer modules. Microcontroller dsPIC30F4013 contains 5 timer modules.
Each timer module contains one 16-bit timer/counter consisting of the following registers:
- TMRx – 16-bit timer counter register,
- PRx – 16-bit period register containing value of the period,
- TxCON – 16-bit control register for selecting mode of the timer.
Each timer module also has the associated bits for interrupt control:
- TxIE – interrupt enable control bit,
- TxIF – interrupt flag status bit,
- TxIP<2:0> - three interrupt priority control bits (in the interrupt register IPCx).
Most of the timers in the family of dsPIC30F microcontrollers have the same functional circuitry. Depending of their functional differences, they are classified into three types: A, B, or C. Timers of the types B and C can be combined to form a 32-bit timer.