Hi all,
Could anybody help me or guide me to write a better ISR code which use lesser memory and compiles smaller hex file.The problem I am facing is if use too many 'if else' conditions in my ISR the hex file compiles shoots t
18Kb whereas if i use one or two conditions only the hex file is around 5K .I want my compiled Hex file to be around 8-10 Kb.Below is my code of ISR./
*************************************************************************************** // Low Priority Interrupt / *************************************************************************************** void HIGH_ISR (void); #pragma code high_vector_section=0x08 void high_vector (void) { _asm goto HIGH_ISR _endasm } #pragma code #pragma interrupt HIGH_ISR void HIGH_ISR (void) {if (PIR1bits.RCIF == 1) // If USART Rx Flag is set { UART_Data.Input = ReadUSART(); // Get character USART module
if(UART_Data.Input == 0x11) { EE_Address = 0xAA; EE_Data = Current_time; Write_EEPROM();
EE_Address = 0xAB; EE_Data = Current_ports; Write_EEPROM(); } else if(UART_Data.Input == 0x12) { Read_EE(); printf("\nCurrent Time settings = %d", eet); printf("\nCurrent Port settings = %d", eep); } else if(UART_Data.Input == 0x13) { printf("\nCurrent Time settings = %x", Current_time); } else if(UART_Data.Input == 0x14) { printf("\nCurrent Port settings = %x", Current_ports); } else if(UART_Data.Input == 0x15) { Current_time = Default_time; Current_ports = Default_ports; delay = (Current_time*5); // Set_Port_Time(); printf("\nCurrent Port settings = %x", Current_ports); }
else if((UART_Data.Input >= 0x21) && (UART_Data.Input = 0x80) { Current_time = ((UART_Data.Input) & (0x7F)); printf("\nTiming Selected = %dms",Current_time*50); delay = (Current_time*5); // Set_Port_Time(); }
else if(UART_Data.Input < 0x80) { PORTB = 0x00; PORTC = 0x00; ports = ((UART_Data.Input) & (0x0F)) ; if( (ports >= 1) && (ports