MC9S08QG4교체
![](https://t1.daumcdn.net/tistoryfile/fs4/2_18_18_6_blog120569_attach_0_7.jpg?original)
![](https://t1.daumcdn.net/tistoryfile/fs4/2_18_18_6_blog120569_attach_0_3.gif?original)
![](https://t1.daumcdn.net/tistoryfile/fs6/3_18_18_6_blog120569_attach_0_9.gif?original)
![](https://t1.daumcdn.net/tistoryfile/fs5/5_18_18_6_blog120569_attach_0_9.gif?original)
![](https://t1.daumcdn.net/tistoryfile/fs4/2_18_18_6_blog120569_attach_0_4.gif?original)
![](https://t1.daumcdn.net/tistoryfile/fs5/5_18_18_6_blog120569_attach_0_10.jpg?original)
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 */ } |