AN2616 Freescale Semiconductor / Motorola, AN2616 Datasheet - Page 33

no-image

AN2616

Manufacturer Part Number
AN2616
Description
Getting Started with HCS08 and CodeWarrior Using C
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Application complete
MOTOROLA
NOTE:
It is important to set the RANGE, REFS and CLKS in the ICGC1 register
together as a single byte store (for example, STA or MOV instruction), and not
by read-modify-write instructions (BSET or BCLR), as attempting to set these
bits individually may result in the clock mode being locked after the first write to
the ICGC1 register.
For more information on setting system clock, refer to the relevant data sheet
and to Application Note “AN2494 — Configuring the System and Peripheral
Clocks in the MC9S08GB/GT “.
The program will operate in exactly the same manner as in the previous
section. The only noticeable difference will be the frequency of LED5 (buzzer
in the case of the evaluation board), as the bus speed of the device has been
set to the maximum using the on-board crystals.
}
Getting Started with HCS08 and CodeWarrior Using C
/*configure Internal Clock Generator [ICG]*/
/*MFD[]={4,6,8,10,12,14,16,18}*/
ICGC2_MFD = 7;
ICGC2_RFD = 0;
ICGC1 = 0b00111000;
while((ICGS1_LOCK==0)||(ICGS1_ERCS==0)){
}
ICGC2_LOCRE = 1; /*enable reset if clock fails*/
for(;;) {
} /* loop forever */
Freescale Semiconductor, Inc.
/*Ensure COP doesn't reset device whilst waiting for clock lock*/
__RESET_WATCHDOG(); /* kicks the dog */
__RESET_WATCHDOG(); /* kicks the dog */
LED2 = SW2;
if(SW3==DOWN){
}
For More Information On This Product,
/*Switch pressed*/
if(SW4==DOWN){/**/
}else{
}
TPM1C0V = DUTY25;/**/
TPM1C0V = DUTY75;/**/
LED3 = ON;/**/
LED4 = OFF;/**/
LED3 = OFF;/**/
LED4 = ON;/**/
Go to: www.freescale.com
/*32KHz crystal, demo board.
*/
/* RFD[]={1,2,4,8,16,32,64,128}*/
/*32KHz crystal, demo board.
*/
For 4MHz crystal (eval board):
For 4MHz crystal (eval board):
ICGC2_MFD = 3
ICGC1 = 0b01111000;
Developing an Application with CodeWarrior
AN2616
33

Related parts for AN2616