아래의 코드를 디버그 했는데 코드의 사이즈가 1024bytes 보다 큰 1369라서 에러가 떴습니다. 축소하는 방법 알려주실 수 없나요...참고로 광마우스의 동작을 컨트롤 하는 코드입니다.
#include <stdio.h> /* common defines and macros */ #include <hidef.h> /* common defines and macros */ #include <mc9s12c128.h> /* derivative information */ #pragma LINK_INFO DERIVATIVE "mc9s12c128"
int Right; int Left; int Up; int Down; int Stop; int curr_state; int prev_state;
void main(void) { EnableInterrupts; /* set port B to output */ DDRB_BIT4 = 1; DDRB_BIT5 = 1; DDRB_BIT6 = 1; DDRB_BIT7 = 1;
/* set port T to input */ DDRT = 0x00; /*enable pullups on pin 0 through 3 of port T */ PERT_PERT2 = 1; PERT_PERT3 = 1; PERT_PERT4 = 1; PERT_PERT5 = 1; /* Turn off LED1 through LED4 */ PORTB = 0xF0;
/*int sci();*/ Right = 0; //Zero counter Left = 0; //Zero counter Up = 0; //Zero counter Down = 0; //Zero counter Stop = 0; /**********************X-Axis**********************/ /* loop forever */
prev_state = 0x00; /*for(;;){ curr_state = (PTT && 0xF0); if(curr_state == prev_state) Stop++; else if(curr_state
curr_state = prev_state; */ for(;;) { curr_state = (PTT && 0xF0); for(;;){ if(curr_state == prev_state) break; else if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } } if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } }if(curr_state == 0x00) for(;;){ if(curr_state == 0x10) { Up++; break; } if(curr_state == 0x20) { Down++; break; } if(curr_state == 0x40) { Right++; break; } if(curr_state == 0x50) { Right++; Up++; break; } if(curr_state == 0x60) { Right++; Down++; break; } if(curr_state == 0x80) { Left++; break; } if(curr_state == 0x90) { Left++; Up++; break; } if(curr_state == 0xA0) { Left++; Down++; break; } } |