MC9S08QG4교체
LED제어 예제 소스코드
//============================================================================= // FreeScale ODBM Test Program // // by nexp76(nexp76@naver.com) // http://cafe.naver.com/elab.cafe // [main.h] //============================================================================= #include <hidef.h> #include "derivative.h"
//----------------------------------------------------------------------------- // Utility Function //----------------------------------------------------------------------------- void Delay(unsigned int Time) { unsigned int i, j;
for(j=0;j<200;j++) for (i = 0; i < Time; i++) {}; } //-----------------------------------------------------------------------------
//----------------------------------------------------------------------------- // LED Function //----------------------------------------------------------------------------- #define Led1Init() (PTADD_PTADD3 = 1)
#define Led1On() (PTAD_PTAD3 = 0) #define Led1Off() (PTAD_PTAD3 = 1) #define Led1Toggle() (PTAD_PTAD3 ^= 1) //-----------------------------------------------------------------------------
//----------------------------------------------------------------------------- //Main Routine //----------------------------------------------------------------------------- void main(void) { //enable interrupts EnableInterrupts;
Led1Init(); Led1On();
for(;;) { __RESET_WATCHDOG(); /* feeds the dog */
Led1Toggle(); Delay(150);
} /* loop forever */ /* please make sure that you never leave main */ } |