Rev 409 | Blame | Compare with Previous | Last modification | View Log | Download
/******************************************************************************* Copyright (C) 2005 Freescale Semiconductor, Inc.* All Rights Reserved** Filename: DEMO9S08QG8_Test.c* Author: r1aald* Revision: 1.0** Description: This is the test code that will reside in the QG8 demo* to provide an out of the box experience. This simple code* blinks LED2 and toggles LED1 when SW1 is pressed.** Notes: Also serves as an example for the 9S08QG8 demo board.* Created using CodeWarrior 3.1 for HC(S)08.******************************************************************************/#include <hidef.h> /* for EnableInterrupts macro */#include <MC9S08QG8.h> /* include peripheral declarations */#include "demo9S08QG8.h" /*include demo board declarations */void main(void) {EnableInterrupts; /* enable interrupts *//* include your code here */ICSC2_BDIV = 3;LED1 =0;LED2 =0; //Port B7 is connected to LED 2PTBDD_PTBDD7 = 1; //Set PTB7 as an outputPTBDD_PTBDD6 = 1;//mtim_setupMTIMCLK_PS = 8;MTIMCLK_CLKS = 0;MTIMMOD = 112;MTIMMOD = 0; //modulo = 50MTIMSC = 0x60; //reset and start MTIM, enable ints//KBI Set Up foe SW1KBIPE_KBIPE2 =1; //Enable Keyboard PinKBISC_KBIE = 1; //Enable Keyboard InterruptsKBISC_KBACK = 1; //Clear Pending Keyboard InterruptsPTAPE_PTAPE2 = 1; //Enable Pullup for Keyboard pinfor(;;) {__RESET_WATCHDOG(); /* feeds the dog */} /* loop forever *//* please make sure that you never leave this function */}//KBI ISRinterrupt 18 void KBI_ISR(void) {KBISC_KBACK = 1; //Clear Pending Keyboard InterruptsLED1 = ~LED1; // toggle Port}/* MTIM_ISR - ISR that accompanies the MTIM PWM routine. */interrupt 12 void MTIM_ISR(void) {MTIMSC_TOF=0; // clear TOFLED2 = ~LED2; // toggle Port}