before(): execution(void Processor_FetchInstruction()) { Clock_Update(); }
/** * \fn void Routine(void) * \brief Retrieves ModCon packets and sends back packets if it is necessary. */ void Routine(void) { UINT8 ack = 0; BOOL bad = bFALSE; if (Clock_Update()) { bad = !HandleModConUptime(); } if (Packet_Get()) { ack = Packet_Command & MODCON_COMMAND_ACK_MASK; /* detect ACK mask from command */ Packet_Command &= ~MODCON_COMMAND_ACK_MASK; /* clear ACK mask from command */ switch(Packet_Command) { case MODCON_COMMAND_STARTUP: bad = !HandleModConStartup(); break; case MODCON_COMMNAD_EEPROM_PROGRAM: bad = !HandleModConEEPROMProgram(); break; case MODCON_COMMAND_EEPROM_GET: bad = !HandleModConEEPROMGet(); break; case MODCON_COMMAND_SPECIAL: bad = !HandleModConSpecial(); break; case MODCON_COMMAND_PROTOCOL_MODE: bad = !HandleModConProtocolMode(); break; case MODCON_COMMAND_NUMBER: bad = !HandleModConNumber(); break; case MODCON_COMMAND_MODE: bad = !HandleModConMode(); break; default: bad = bTRUE; break; } if (ack) { if (!bad) { if (!Packet_Put(Packet_Command | MODCON_COMMAND_ACK_MASK, Packet_Parameter1, Packet_Parameter2, Packet_Parameter3)) { #ifndef NO_DEBUG DEBUG(__LINE__, ERR_PACKET_PUT); #endif } } else { /* NOTE: ACK mask has been cleared already */ if (!Packet_Put(Packet_Command, Packet_Parameter1, Packet_Parameter2, Packet_Parameter3)) { #ifndef NO_DEBUG DEBUG(__LINE__, ERR_PACKET_PUT); #endif } } } } }
void menu() { exit_menu = 0; uint8_t menu,regreso,opcion=0,continue_menu=0; while(exit_menu ==0) { regreso =0; clrscr(); gotoxy(0x01,0x01); UART0_putsf(MenuOp); menu = UART0_getch(); switch (menu) { case 'a': /*Mensaje de marquesina */ { clrscr(); UART0_putsf(SubMenuOp1); gotoxy(6,10); TextSave(TEXT_ADDRESS); exit_menu =0; break; } case 'b': /*Ajuste de Reloj*/ { clrscr(); gotoxy(0x01,0x01); UART0_putsf(SubMenuOp2); opcion = 0; while(opcion == 0) { if( Timer2_Flag ()) { gotoxy(0x06,0x06); Clock_Update(); Clock_Display(); } if(UART0_kbhit() == 0x0D) { clrscr(); gotoxy(0x01,0x01); UART0_putsf(SubMenuOp2a); gotoxy(0x06,0x06); config_clock(); clrscr(); gotoxy(0x01,0x01); UART0_putsf(SubMenuOp2); opcion = 0; } if(UART0_kbhit() == 0x1B) { opcion = 1; } } /* ajuste(hr:min) (mostrar reloj actual) */ exit_menu =0; break; } case 'c': { exit_menu =1; clrscr(); break;/*Salir */ } default: { exit_menu =0; break; } } } if(continue_menu == 1) { clrscr(); } }