#pragma warn- #include #include #include #include //Time constants #define reload 6 //value for 1 msec at 16 MHz #define second 1000 #define quarterSecond 250 #define halfSecond 500 #define millisec50 50 #define halfmin 30000 // FSM states #define normalMenu 1 #define silenceMenu 2 #define silenceZone 3 #define setupMenu 4 #define changePasscode 5 #define enterPasscode 6 #define setTimeMenu 7 #define zoneEnableMenu 8 #define systemNameMenu 9 #define zoneNameMenu 10 #define zoneNameMenu2 11 #define pwdEnableMenu 12 // Alarm/trouble constant #define intoAlarm 12 // Number of successive times input must be on before alarm is detected #define intoTrouble 12 // Number of successive times input must be on before trouble is detected char i; // index char j; // yet another index char charIn; // input character int time; // keeps track of ms char seconds; // clock seconds char mins; // clock minutes char hours; // clock hours char secondstmp; // clock temporary seconds (for setting) char minstmp; // clock temporary minutes (for setting) char hourstmp; // clock temporary hours (for setting) char menuState; // keeps track of state of menu outputted char silenceFlag; // Flag is high if system is silenced char silenceZones[8]; // Array of flags for silenced zones char passwordState; // Current State of Password unsigned int tempPassword; // temporary Entered Password unsigned int tempPassword1; // another temporary entered password char invalidInput; // Flags Invalid input char invalidPassword; // Flag for Invalid Password char sysNameDefault[50] = "Fire Alarm System"; char sysName[50] = "Name Output Error"; char sysNameTmp[50]; // For setting system names char alarmFlag; // High if system is in alarm - can only be reset by user char ackFlag; // Systems beeps until alarm is acknowledged (Normal is low) char timeSetState; // State for setting time char nameIndex; // Temporary variable for setting names char zoneTmp; // Keeps state of zone being worked on // Customizable zone names char zoneName[8][25]= {"Zone 1", "Zone 2", "Zone 3", "Zone 4", "Zone 5", "Zone 6", "Zone 7", "Zone 8"}; // Zone names in SRAM char zoneNameTmp[25]; // Temp zone name - for name changes char pwd1[6], pwd2[6], pwd3[6]; // Used for representing entered password figures (passwords are hidden with *) // Alarm/trouble states char zoneTrouble[8]; char zoneAlarm[8]; char reprintZone[8]; // High if zone was changed and info needs to be reprinted char reprintAlarm; // Reprint system alarm info eeprom char sysNamePROM[50]; // customizable system name eeprom char zoneEnable[8]; eeprom char passwordEnable; // Enable flag for password eeprom unsigned int passCode; // customizable passcode eeprom char resetDefault; // reset EEPROM values to defaults - 38 to not reset // Customizable zone names eeprom char zoneNamePROM[8][25]; interrupt [TIM0_OVF] void timer0_overflow(void) { TCNT0 = reload; time++; if (time == second){ time = 0; // Clock code if (seconds < 59) seconds++; else { seconds = 0; if (mins < 59) mins++; else{ mins = 0; if (hours < 23) hours++; else hours = 0; } } // Print time printf("%c[0;52H", 27); // move cursor to top left printf("%i%i:%i%i:%i%i", hours/10, hours%10, mins/10, mins%10, seconds/10, seconds%10); } // if (time == second){ */;} else if ((time % quarterSecond) == 0){ for(i= 0; i<8; i++){ if(!zoneEnable[i] && reprintZone[i]){ printf("%c[%i;30H", 27, 3+i); // move cursor to line 2 printf("Disabled"); printf("%c[0K", 27); reprintZone[i]=0; } else if (zoneEnable[i] && reprintZone[i] && !zoneTrouble[i] && !zoneAlarm[i]){ reprintZone[i] = 0; printf("%c[%i;30H", 27, 3+i); // move cursor to line 2 printf("%c[0K", 27); } } // Alarm/trouble detection code // Detect presence of trouble if(!PINA.0 && (zoneTrouble[0] < intoTrouble) && zoneEnable[0]) {zoneTrouble[0]++; reprintZone[0] = 1;} if(!PINA.1 && (zoneTrouble[1] < intoTrouble) && zoneEnable[1]) {zoneTrouble[1]++; reprintZone[1] = 1;} if(!PINA.2 && (zoneTrouble[2] < intoTrouble) && zoneEnable[2]) {zoneTrouble[2]++; reprintZone[2] = 1;} if(!PINA.3 && (zoneTrouble[3] < intoTrouble) && zoneEnable[3]) {zoneTrouble[3]++; reprintZone[3] = 1;} if(!PINA.4 && (zoneTrouble[4] < intoTrouble) && zoneEnable[4]) {zoneTrouble[4]++; reprintZone[4] = 1;} if(!PINA.5 && (zoneTrouble[5] < intoTrouble) && zoneEnable[5]) {zoneTrouble[5]++; reprintZone[5] = 1;} if(!PINA.6 && (zoneTrouble[6] < intoTrouble) && zoneEnable[6]) {zoneTrouble[6]++; reprintZone[6] = 1;} if(!PINA.7 && (zoneTrouble[7] < intoTrouble) && zoneEnable[7]) {zoneTrouble[7]++; reprintZone[7] = 1;} // Detect no more trouble if(PINA.0 && zoneTrouble[0] && zoneEnable[0]) {zoneTrouble[0]--; reprintZone[0] = 1;} if(PINA.1 && zoneTrouble[1] && zoneEnable[1]) {zoneTrouble[1]--; reprintZone[1] = 1;} if(PINA.2 && zoneTrouble[2] && zoneEnable[2]) {zoneTrouble[2]--; reprintZone[2] = 1;} if(PINA.3 && zoneTrouble[3] && zoneEnable[3]) {zoneTrouble[3]--; reprintZone[3] = 1;} if(PINA.4 && zoneTrouble[4] && zoneEnable[4]) {zoneTrouble[4]--; reprintZone[4] = 1;} if(PINA.5 && zoneTrouble[5] && zoneEnable[5]) {zoneTrouble[5]--; reprintZone[5] = 1;} if(PINA.6 && zoneTrouble[6] && zoneEnable[6]) {zoneTrouble[6]--; reprintZone[6] = 1;} if(PINA.7 && zoneTrouble[7] && zoneEnable[7]) {zoneTrouble[7]--; reprintZone[7] = 1;} for(i=0;i<8;i++){ // If trouble and zone enabled, print it if((zoneTrouble[i] == intoTrouble) && zoneEnable[i] && reprintZone[i]){ reprintZone[i] = 0; printf("%c[%i;30H", 27, 3+i); // move cursor to line 2 printf("%c[0K", 27); printf("Trouble"); printf("%c[0K", 27); } else if (reprintZone[i] && !zoneTrouble[i] && zoneEnable[i]){ if (!zoneAlarm[i]) reprintZone[i] = 0; printf("%c[%i;30H", 27, 3+i); // move cursor to line 2 printf("%c[0K", 27); } } //for(i=0;i<8;i++){ //if(PINB != 0x00){ // Detect presence of alarm if(PINB.0 && PINA.0 && (zoneAlarm[0] < intoAlarm) && zoneEnable[0]) {zoneAlarm[0]++; reprintZone[0] = 1;} if(PINB.1 && PINA.1 && (zoneAlarm[1] < intoAlarm) && zoneEnable[1]) {zoneAlarm[1]++; reprintZone[1] = 1;} if(PINB.2 && PINA.2 && (zoneAlarm[2] < intoAlarm) && zoneEnable[2]) {zoneAlarm[2]++; reprintZone[2] = 1;} if(PINB.3 && PINA.3 && (zoneAlarm[3] < intoAlarm) && zoneEnable[3]) {zoneAlarm[3]++; reprintZone[3] = 1;} if(PINB.4 && PINA.4 && (zoneAlarm[4] < intoAlarm) && zoneEnable[4]) {zoneAlarm[4]++; reprintZone[4] = 1;} if(PINB.5 && PINA.5 && (zoneAlarm[5] < intoAlarm) && zoneEnable[5]) {zoneAlarm[5]++; reprintZone[5] = 1;} if(PINB.6 && PINA.6 && (zoneAlarm[6] < intoAlarm) && zoneEnable[6]) {zoneAlarm[6]++; reprintZone[6] = 1;} if(PINB.7 && PINA.7 && (zoneAlarm[7] < intoAlarm) && zoneEnable[7]) {zoneAlarm[7]++; reprintZone[7] = 1;} // Detect no more alarm if(!PINB.0 && zoneAlarm[0] && zoneEnable[0]) {zoneAlarm[0]--; reprintZone[0] = 1;} if(!PINB.1 && zoneAlarm[1] && zoneEnable[1]) {zoneAlarm[1]--; reprintZone[1] = 1;} if(!PINB.2 && zoneAlarm[2] && zoneEnable[2]) {zoneAlarm[2]--; reprintZone[2] = 1;} if(!PINB.3 && zoneAlarm[3] && zoneEnable[3]) {zoneAlarm[3]--; reprintZone[3] = 1;} if(!PINB.4 && zoneAlarm[4] && zoneEnable[4]) {zoneAlarm[4]--; reprintZone[4] = 1;} if(!PINB.5 && zoneAlarm[5] && zoneEnable[5]) {zoneAlarm[5]--; reprintZone[5] = 1;} if(!PINB.6 && zoneAlarm[6] && zoneEnable[6]) {zoneAlarm[6]--; reprintZone[6] = 1;} if(!PINB.7 && zoneAlarm[7] && zoneEnable[7]) {zoneAlarm[7]--; reprintZone[7] = 1;} for(i=0;i<8;i++){ // If alarm and zone enabled, print it if((zoneAlarm[i] == intoAlarm) && zoneEnable[i] && reprintZone[i]){ reprintZone[i] = 0; printf("%c[%i;30H", 27, 3+i); // move cursor to line 2 printf("%c[0K", 27); printf("ALARM"); if(silenceZones[i]){ printf("%c[%i;40H", 27, 3+i); // move cursor to line 2 printf("ZONE SILENT"); } if(!silenceFlag && !silenceZones[i]){ PORTC = 0x00; } printf("%c[0K", 27); alarmFlag = 1; ackFlag = 0; reprintAlarm = 1; } else if (reprintZone[i] && !zoneAlarm[i] && zoneEnable[i] && (zoneTrouble < intoTrouble - 2)){ if (!zoneTrouble[i]) reprintZone[i] = 0; printf("%c[%i;30H", 27, 3+i); // move cursor to line 2 printf("%c[0K", 27); if(silenceZones[i]){ printf("%c[%i;30H", 27, 3+i); // move cursor to line 2 printf("ZONE SILENT"); } } } //for(i=0;i<8;i++){ if(alarmFlag && !ackFlag && time == 250){ printf("%c",7); } else if (ackFlag == 1){ ackFlag++; printf("%c[12;0H", 27); // go to line 11 printf("%c[0K", 27); } if(silenceFlag == 1){ printf("%c[2;20H", 27); printf("SYSTEM SILENT"); silenceFlag++; } if(alarmFlag && reprintAlarm){ reprintAlarm = 0; printf("%c[2;0H", 27); printf("%c[5m", 27); // blink printf("SYSTEM ALARM"); printf("%c[0m", 27); // end blink printf("%c[12;0H", 27); // go to line 11 printf("Press space to acknowledge alarm"); } else if(reprintAlarm){ reprintAlarm = 0; printf("%c[2;0H", 27); printf("%c[0K", 27); } } else if ((time % millisec50) == 0){ if (UCSRA.7) //RX done bit { charIn=getchar(); /*putchar(charIn); putsf("\r\n"); */ if(charIn == 27){ menuState = normalMenu; invalidInput = 0; invalidPassword =0; passwordState = 0; tempPassword = 0; nameIndex = 0; // reset name index for(i=0;i<6;i++){ pwd1[i]='\0'; pwd2[i]='\0'; pwd3[i]='\0'; } for(i=0;i<25;i++){ zoneNameTmp[i]='\0'; } for(i=0;i<50;i++){ sysNameTmp[i]='\0'; } }//if(charIn == 27) else if((charIn == 32) && !ackFlag && alarmFlag) ackFlag = 1; else if(charIn){ // FSM code switch(menuState){ case normalMenu: switch(charIn){ case '1': menuState = silenceMenu; break; case '2': if(!passwordEnable)menuState = setupMenu; else menuState = enterPasscode; break; case '3': alarmFlag = 0; reprintAlarm = 1; PORTC = 0xFF; printf("%c[12;0H", 27); // go to line 12 printf("%c[0K", 27); printf("%c[11;0H", 27); // go to line 11 printf("%c[0K", 27); break; case '4': alarmFlag = 1; reprintAlarm = 1; PORTC = 0x00; printf("%c[11;0H", 27); // go to line 11 printf("%c[5m", 27); // blink printf("MANUAL ALARM"); printf("%c[0m", 27); // end blink PORTC = 0x00; default: break; } break; case silenceMenu: switch(charIn){ case '1': menuState = normalMenu; silenceFlag = silenceFlag ? 0:1; printf("%c[2;20H", 27); printf("%c[0K",27); PORTC = 0xFF; break; case '2': menuState = silenceZone; break; default: break; } break; case silenceZone: switch(charIn){ case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': zoneTmp = charIn - 49; menuState = normalMenu; silenceZones[zoneTmp] = (silenceZones[zoneTmp]) ? 0:1; reprintZone[zoneTmp] = 1; break; default: break; } break; case enterPasscode: if ((charIn<=57) && (charIn>=48)) charIn = charIn - 48; else if (charIn == 27){menuState = normalMenu; break;} else {invalidInput++; passwordState = 0; break;} switch(passwordState){ case 0: tempPassword = (int)charIn*10000; pwd1[0] = '*'; passwordState++; break; case 1: tempPassword = (int)charIn*1000 + tempPassword; pwd1[1] = '*'; passwordState++; break; case 2: tempPassword = (int)charIn*100 + tempPassword; pwd1[2] = '*'; passwordState++; break; case 3: tempPassword = (int)charIn*10 + tempPassword; pwd1[3] = '*'; passwordState++; break; case 4: tempPassword = (int)charIn + tempPassword; passwordState = 0; for(i=0;i<6;i++)pwd1[i] = '\0'; if(tempPassword == passCode) menuState = setupMenu; else {invalidPassword++; menuState = normalMenu;} break; default: printf("\n\r**ERROR - RESET MACHINE"); } break; case setupMenu: switch(charIn){ case '1': menuState = setTimeMenu; break; case '2': menuState = zoneEnableMenu; break; case '3': menuState = systemNameMenu; break; case '4': menuState = zoneNameMenu; break; case '5': menuState = pwdEnableMenu; break; case '6': menuState = changePasscode; break; default: break; } break; case setTimeMenu: switch(timeSetState){ case 0: timeSetState++; // Hour first digit switch(charIn){ case '0': hourstmp = 0; break; case '1': hourstmp = 10; break; case '2': hourstmp = 20; break; default: timeSetState--; break; } break; case 1: timeSetState++; // Hour second digit switch(charIn){ case '0': case '1': case '2': case '3': hourstmp = hourstmp+(charIn-48); break; case '4': case '5': case '6': case '7': case '8': case '9': if (hourstmp < 11) hourstmp = hourstmp+(charIn-48); else timeSetState--; break; default: timeSetState--; break; } break; case 2: timeSetState++; switch(charIn){ case '0': case '1': case '2': case '3': case '4': case '5': case '6': minstmp = 10*(charIn-48); break; default: timeSetState--; break; } break; case 3: timeSetState++; switch(charIn){ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': minstmp = minstmp + (charIn-48); break; default: timeSetState--; break; } break; case 4: timeSetState++; switch(charIn){ case '0': case '1': case '2': case '3': case '4': case '5': case '6': secondstmp = 10*(charIn-48); break; default: timeSetState--; break; } break; case 5: switch(charIn){ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': seconds = secondstmp + (charIn-48); mins = minstmp; hours = hourstmp; timeSetState = 0; menuState = normalMenu; break; default: timeSetState--; break; } break; default: printf("\n\rERROR Time Set: %i\n\r", timeSetState); break; } break; case zoneEnableMenu: switch(charIn){ case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': zoneTmp = charIn - 49; zoneEnable[zoneTmp] = (zoneEnable[zoneTmp]) ? 0:1; menuState = normalMenu; reprintZone[zoneTmp]=1; if (!zoneEnable[zoneTmp]){ zoneTrouble[zoneTmp] = 0; zoneAlarm[zoneTmp] = 0; } break; default: break; } break; case systemNameMenu: if((nameIndex<49) && (charIn != 13)){ sysNameTmp[nameIndex] = charIn; nameIndex++; } else{ sysNameTmp[nameIndex] = '\0'; // Terminate string with terminator character nameIndex = 0; // Reset for next time for(i=0;(i<50);i++){ // Set SRAM string (for printing) sysNamePROM[i]=sysNameTmp[i]; sysName[i]=sysNamePROM[i]; sysNameTmp[i] = '\0'; } //System name printf("%c[0;50H", 27); // move cursor to end of string printf("%c[1K", 27); // erase screen printf("%c[0;0H", 27); // move cursor to beginning of line printf("\r%s\n\r",sysName); printf("%c[0;0H", 27); // move cursor to line 1 menuState = normalMenu; }// else break; case zoneNameMenu: switch(charIn){ case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': zoneTmp = charIn-49; menuState = zoneNameMenu2; break; default: break; } break; case zoneNameMenu2: if((nameIndex<24) && (charIn != 13)){ zoneNameTmp[nameIndex] = charIn; nameIndex++; /*printf("%c[15;%iH", 27, 28+nameIndex); // move cursor to end of prompt printf("%c", charIn);*/ } else{ zoneNameTmp[nameIndex] = '\0'; // Terminate string with terminator character nameIndex = 0; // Reset for next time for(i=0;(i<50);i++){ // Set SRAM string (for printing) zoneNamePROM[zoneTmp][i]=zoneNameTmp[i]; zoneName[zoneTmp][i]=zoneNameTmp[i]; zoneNameTmp[i] = '\0'; // Reset zone name displayed } //Zone name printf("%c[%i;26H", 27, 3+zoneTmp); // move cursor to line, end of string printf("%c[1K", 27); // erase line printf("%c[%i;0H", 27, 3+zoneTmp); // move cursor to line printf("%s", zoneName[zoneTmp]); menuState = normalMenu; } break; case pwdEnableMenu: switch(charIn){ case '1': passwordEnable = 1; menuState = normalMenu; break; case '2': passwordEnable = 0; menuState = normalMenu; break; default: break; } break; case changePasscode: if ((charIn<=57) && (charIn>=48)) charIn = charIn - 48; else if (charIn == 27){menuState = normalMenu; break;} else {invalidInput++; passwordState = 0; break;} switch(passwordState){ case 0: tempPassword = (int)charIn*10000; pwd1[0] = '*'; passwordState++; break; case 1: tempPassword = (int)charIn*1000 + tempPassword; pwd1[1] = '*'; passwordState++; break; case 2: tempPassword = (int)charIn*100 + tempPassword; pwd1[2] = '*'; passwordState++; break; case 3: tempPassword = (int)charIn*10 + tempPassword; pwd1[3] = '*'; passwordState++; break; case 4: tempPassword = (int)charIn + tempPassword; pwd1[4] = '*'; if(tempPassword == passCode) passwordState++; else {invalidPassword++; passwordState = 0; for(i=0;i<6;i++)pwd1[i] = '\0';} break; case 5: tempPassword = (int)charIn*10000; pwd2[0] = '*'; passwordState++; break; case 6: tempPassword = (int)charIn*1000 + tempPassword; pwd2[1] = '*'; passwordState++; break; case 7: tempPassword = (int)charIn*100 + tempPassword; pwd2[2] = '*'; passwordState++; break; case 8: tempPassword = (int)charIn*10 + tempPassword; pwd2[3] = '*'; passwordState++; break; case 9: tempPassword = (int)charIn + tempPassword; pwd2[4] = '*'; passwordState++; break; case 10: tempPassword1 = (int)charIn*10000; pwd3[0] = '*'; passwordState++; break; case 11: tempPassword1 = (int)charIn*1000 + tempPassword1; pwd3[1] = '*'; passwordState++; break; case 12: tempPassword1 = (int)charIn*100 + tempPassword1; pwd3[2] = '*'; passwordState++; break; case 13: tempPassword1 = (int)charIn*10 + tempPassword1; pwd3[3] = '*'; passwordState++; break; case 14: tempPassword1 = (int)charIn + tempPassword1; pwd3[4] = '*'; for(i=0;i<6;i++){pwd2[i] = '\0'; pwd3[i] = '\0';} if(tempPassword == tempPassword1){ passwordState=0; passCode = tempPassword; menuState = normalMenu; for(i=0;i<6;i++){pwd1[i] = '\0';} } else {passwordState = 5;} break; default: printf("\n\r**ERROR - RESET MACHINE"); } break; default: printf("\n\r**FSM ERROR**\n\r"); break; } //switch(menuState){ } //else if(charIn) // Menu print code printf("%c[15;0H", 27); // move cursor to line 15 printf("%c[0J", 27); // erase screen switch(menuState){ case normalMenu: printf("Main Menu\n\r 1. Silence System/Zone \n\r 2. Setup System \n\r 3. Reset System \n\r 4. Alarm System"); break; case silenceMenu: printf("Silence System/System\n\r 1. Silence System \n\r 2. Silence Zone\r"); break; case silenceZone: printf("Enter Zone Number: "); break; case enterPasscode: printf("Enter Password: %s", pwd1); break; case setupMenu: printf("Setup Menu\n\r 1. Set Time\n\r 2. Enable/Disable Zone\n\r"); printf(" 3. Change System Name\n\r 4. Change Zone Name\n\r"); printf(" 5. Enable/Disable Password\n\r 6. Change Password\n\r"); break; case setTimeMenu: printf("Set Time\n\r"); switch(timeSetState){ case 0: printf(" : : "); break; case 1: printf("%i : : ", hourstmp/10);break; case 2: printf("%i%i: : ", hourstmp/10, hourstmp%10); break; case 3: printf("%i%i:%i : ", hourstmp/10, hourstmp%10, minstmp/10); break; case 4: printf("%i%i:%i%i: ", hourstmp/10, hourstmp%10, minstmp/10, minstmp%10); break; case 5: printf("%i%i:%i%i:%i ", hourstmp/10, hourstmp%10, minstmp/10, minstmp%10, secondstmp/10); break; } break; case zoneEnableMenu: printf("Select zone to enable/disable: "); break; case systemNameMenu: printf("Please set new system name: %s", sysNameTmp); break; case zoneNameMenu: printf("Enter zone to edit (1-8): "); break; case zoneNameMenu2: printf("Zone %i name: %s", zoneTmp+1, zoneNameTmp); break; case pwdEnableMenu: printf("Enable/disable password? \n\r 1. Enable\n\r 2. Disable"); break; case changePasscode: printf("Change password \n\rEnter old password: %s\n\r Enter new password: %s\n\rReenter new password: %s", pwd1, pwd2, pwd3); break; default: printf("Error - Menu State Error"); break; } // switch(menuState){ charIn = 0; }// if(UCSRA.7) } // else if (time == millisec50){ */ } //interrupt [TIM0_OVF] void timer0_overflow(void) void main(void) { UCSRB = 0x10 + 0x08 ; UBRRL = 103 ; //set up ports PORTC = 0xFF; DDRA = 0x00; DDRB = 0x00; DDRC = 0xFF; //set up timer0 time = 0; TCCR0 = 3; //prescale /64 TCNT0=reload; TIMSK=1; //turn on timer 0 overflow ISR /*** Setup EEPROM ***/ if(resetDefault != 38){ passwordEnable = 0; passCode = 12345; for(i=0;(i<50);i++){ sysNamePROM[i]=sysNameDefault[i]; } for(i = 0; i<8; i++){ zoneEnable[i] = 0; } resetDefault = 38; for(i = 0; i<8; i++) zoneNamePROM[i][0] = '\0'; } // if(resetDefault){ alarmFlag = 0; ackFlag = 0; timeSetState = 0; seconds = 0; mins = 0; hours = 0; menuState = setTimeMenu; // Start by setting time charIn = 0; // Initialize charIn silenceFlag = 0; // Start with system in unsilenced mode invalidPassword = 0; // Invalid Password State invalidInput = 0; // Invalid Input State passwordState = 0; // State of password entered for(i=0;i<6;i++){ pwd1[i]='\0'; pwd2[i]='\0'; pwd3[i]='\0'; } for(i=0;i<8;i++){ // Start in unsilenced mode silenceZones[i]=0; zoneAlarm[i]=0; zoneTrouble[i]=0; reprintZone[i]=0; } for(i=0;(i<50);i++){ // Set SRAM string (for printing) sysName[i]=sysNamePROM[i]; } nameIndex = 0; // Reset name index //System name printf("%c[0;0H", 27); // move cursor to top left printf("%c[0J", 27); // erase screen printf("\r%s\n\r",sysName); for(i=0; i<8; i++){ printf("%c[%i;0H", 27, 3+i); // move cursor to line 2 printf("%s", zoneName[i]); } // for(i=0; i<8; i++){ printf("%c[15;0H", 27); // move cursor to line 15 printf("Set Time\n\r"); printf(" : : "); for(i= 0; i<8; i++) if(!zoneEnable[i]){ printf("%c[%i;30H", 27, 3+i); // move cursor to line required printf("Disabled"); } #asm("sei"); #asm("sleep"); }