AN2090 Freescale Semiconductor / Motorola, AN2090 Datasheet - Page 15

no-image

AN2090

Manufacturer Part Number
AN2090
Description
Using the SC140/SC1400 Enhanced On-Chip Emulator Stopwatch Timer
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
void EOnCE_LED_init()
{
}
5.1.2 Toggling EE1
The initialization previously discussed the set up of EE1 to toggle each time an event is detected by EDCA1. The
same channel is also used to trigger the stopwatch timer to count. Therefore, all that remains is to create an EDCA1
event when the stopwatch timer stops. This is achieved by writing to the Enhanced OnCE stopwatch timer flag
variable. Caution should be taken to perform this write only after execution of EOnCE_stopwatch_timer_stop().
void EOnCE_LED_off(){
}
5.2 Testing the Stopwatch Timer
The program in Example 9 sets up the stopwatch timer and measures the time it takes to execute two loops whose
duration is built into the program. The measured code sequences are constructed to take 5 seconds and 3 seconds,
respectively. These durations are constructed as the code samples the emulator counter and loop until the expected
number of clock cycles have passed. Trying this code prior to measuring the target application is recommended as
a means of verifying correct system set-up. If the times measured are not correct, check the PLL set-up and the
values of the clock speed and the memory-mapped register base (as set in the header files).
Freescale Semiconductor
EOnCE_stopwatch_timer_flag = 0; /* Create an EDCA1 event */
#include <stdio.h>
#include "EOnCE_stopwatch.h"
#ifdef COMPILER_BETA_1_BUG
extern long ECNT_VAL;
#else
#include "EOnCE_registers.h"
#endif
void PLL_setup_300MHz()
{
}
void main(){
asm("move.l #$80030003,PCTL0");
asm("move.l #$00010000,PCTL1");
unsigned long clock_ext,clock_val,clock_cycle,cycle_req;
unsigned long time_sec;
extern unsigned long CLOCK_SPEED;
PLL_setup_300MHz();
EOnCE_stopwatch_timer_init();
EOnCE_LED_init();
*((long *)EE_CTRL) &= ~(3<<2); /* Toggle EE1 when event1 happens */
Using the SC140/SC1400 Enhanced On-Chip Emulator Stopwatch Timer, Rev. 1
Example 7. EOnCE_LED_init()
Example 8. Turn LED Off
Example 9. Testing Code
/* Setup to event detector 1 for any write to
/* Setup LED to toggle in detection of
dummy variable. Setup EOnCE event counter
to count if event 1 happens */
event 1 */
Verifying Correct Set-up
15

Related parts for AN2090