TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Lab 4 – Timers and Polling Fall, 2010 MPC8360 Micro Controllers
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Objectives ► Getting familiar with the MPC8360 Timers Block. ► Getting to know the Polling mechanism
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc IMMRBAR - I nternal M emory M ap R egisters B ase A ddress R egister
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc QUICC Engine Timers (GTM) ► The global timer module in the QUICC Engine (GTM) includes four identical 16-bit general-purpose timers. E300 Core QUICC Engine Timers 0x10_0000 0x0440
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Timers Block Diagram
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Configuration Register (GTCFR1) Offset 0x RWRW PCASBCMSTP2RST2GM2GM1STP1RST1 ResetAll Zeros The Actual Address Of any Register in the timers block is: IMMRBAR QUICC Engine Offset Timers Offset Register Offset For Example the actual address of GTCFR: +0x0010_00000xE000_0000+0x0000_ x0000_0000 = 0xE010_0440
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Configuration Register (GTCFR1) Offset 0x RWRW PCASBCMSTP2RST2GM2GM1STP1RST1 ResetAll Zeros RST1 Reset timer 1 0 Reset the timer 1, including GTMDR1, GTRFR1, GTCNR1, GTCPR1 and GTEVR1 (a software reset is identical to an external reset). 1Enable the corresponding timer if the STP1 bit is cleared
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Configuration Register (GTCFR1) Offset 0x RWRW PCASBCMSTP2RST2GM2GM1STP1RST1 ResetAll Zeros STP1 Stop timer 1 0Normal operation 1Reduce power consumption of the corresponding timer. This bit stops all clocks to the timer 1 ….
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Counter Register (GTCNR1) Offset 0x1C 015 RWRW CNV ResetAll Zeros
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Counter Register (GTCNR1) Offset 0x1C 015 RWRW CNV ResetAll Zeros CNV Counter Value Corresponding timer’s 16-bit read/write up-counter value.
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Reference Register (GTRFR1) Offset 0x RWRW TRV ResetAll Ones
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Reference Register (GTRFR1) Offset 0x RWRW TRV ResetAll Ones TRV Timeout Reference Value 16-bit timeout reference value for the corresponding timer. Set to all ones by reset.
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Event Register (GTEVR1) Offset 0x RWRW REFCAP ResetAll Zeros
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Event Register (GTEVR1) Offset 0x RWRW REFCAP ResetAll Zeros REF Output Reference Event 0No event 1The counter has reached the GTRFRx[TRV] value.
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Prescale Register (GTPSR1) Offset 0x RWRW PPS ResetAll Zeros
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Prescale Register (GTPSR1) Offset 0x RWRW PPS ResetAll Zeros PPS Primary Prescaler Bits The primary prescaler is programmed to divide the clock input to corresponding timer by values from 1 to 256. The value 0x00 divides the clock by 1 and 0xFF divides the clock by 256.
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Mode Registers (GTMDR1) Offset 0x RWRW SPSCE OMORIFRRICLKGE ResetAll Zeros
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Mode Registers (GTMDR1) Offset 0x RWRW SPSCE OMORIFRRICLKGE ResetAll Zeros SPS Secondary Prescaler Value The secondary prescaler is programmed to divide the clock input to corresponding timer by values from 1 to 256. The value 0x00 divides the clock by 1 and 0xFF divides the clock by 256.
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Mode Registers (GTMDR1) Offset 0x RWRW SPSCE OMORIFRRICLKGE ResetAll Zeros FRR Free run/restart mode 0 Free run. The timer count continues to increment after the reference value is reached 1Restart. The timer count is reset immediately after the reference value is reached.
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Global Timers Mode Registers (GTMDR1) Offset 0x RWRW SPSCE OMORIFRRICLKGE ResetAll Zeros ICLK Input clock source for the timer 01Internal QUICC Engine reference clock. 10Internal “slow go” clock (divided by 16 QUICC Engine reference clock).
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc The LED ► On the MPC8360 board we have a LED (small red light), that is controlled via a register which is located at address 0xF800_0008. ► To Turn the LED on write ‘0’ to bit number 14. ► To Turn the LED off write ‘1’ to bit number 14. ► There is a second LED which controlled by bit number 13
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc I/O I/O is how humans interact with computers I/O gives computers long-term memory. External devices I/O
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Polling actively sampling the status of an external or internal device by a client program. CPU does nothing other than check the status of the device until it is ready (Busy Waiting) Polling can be scheduled between several devices. E300 CORE Mouse Printer Timers External device Internal device Polling
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Polling why we need it? A way to connect many types of devices to the Microcontroller. A way to control external and internal devices, respond to them and transfer data in the exact time and speed.
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Polling Example : void asm Timers_Polling { whlie (1) { if (Timer_Counter_Value==0x5) { Action; } Busy waiting Device is ready
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc General Notes ► Make sure to bring the codes you have written in previous labs. ► Please READ the exercise before you start working on it !! ► The High-Score table has nothing to do with your grades
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc Quick Overview