Victor Szultka
/
Project_Wetbench
Simulation of a chemical etch wetbench tank
main.cpp@0:1a475dea8e4f, 2020-07-31 (annotated)
- Committer:
- saltire78
- Date:
- Fri Jul 31 17:56:44 2020 +0000
- Revision:
- 0:1a475dea8e4f
posting online
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
saltire78 | 0:1a475dea8e4f | 1 | // including necessary header folders |
saltire78 | 0:1a475dea8e4f | 2 | #include"mbed.h" |
saltire78 | 0:1a475dea8e4f | 3 | #include"C12832.h" |
saltire78 | 0:1a475dea8e4f | 4 | |
saltire78 | 0:1a475dea8e4f | 5 | // declaring necessary components and variables |
saltire78 | 0:1a475dea8e4f | 6 | Serial pc(USBTX,USBRX); //USB tx,rx |
saltire78 | 0:1a475dea8e4f | 7 | C12832 lcd(p5,p7,p6,p8,p11); //Breakout board lcd |
saltire78 | 0:1a475dea8e4f | 8 | |
saltire78 | 0:1a475dea8e4f | 9 | AnalogIn lvl(p19); //pot1 level sensor |
saltire78 | 0:1a475dea8e4f | 10 | AnalogIn temp(p20); //pot2 temperature sensor |
saltire78 | 0:1a475dea8e4f | 11 | |
saltire78 | 0:1a475dea8e4f | 12 | DigitalIn start(p15); //joystick up start button |
saltire78 | 0:1a475dea8e4f | 13 | DigitalIn prod(p13); //joystick left product detected in tank (simulates sensor input) |
saltire78 | 0:1a475dea8e4f | 14 | DigitalOut invalve(LED1); //LED1 represents an input valve to fill the tank - open is true |
saltire78 | 0:1a475dea8e4f | 15 | DigitalOut outvalve(LED2); //LED2 represents an output valve to empty the tank - open is true |
saltire78 | 0:1a475dea8e4f | 16 | DigitalOut heatstir(LED3); //LED3 represents an heater and stirrer to maintain temp and stir the tank - on is true |
saltire78 | 0:1a475dea8e4f | 17 | DigitalOut sysrun(LED4); //LED4 represents a Clear To Run signal outputted to system to allow product loading - on is true |
saltire78 | 0:1a475dea8e4f | 18 | Timer debounce; |
saltire78 | 0:1a475dea8e4f | 19 | |
saltire78 | 0:1a475dea8e4f | 20 | InterruptIn emo(p14); //joystick button EMO activation button (Interrupt) |
saltire78 | 0:1a475dea8e4f | 21 | InterruptIn stop(p12); //joystick down stop button (Interrupt) |
saltire78 | 0:1a475dea8e4f | 22 | |
saltire78 | 0:1a475dea8e4f | 23 | /* criteria set for tank level between 0 and 25 litres, temperature between 0 and 200 degrees C. |
saltire78 | 0:1a475dea8e4f | 24 | Low/High levels represent acceptable manufacturing level. Critical levels will indicate system/equipment failure and dump tank. |
saltire78 | 0:1a475dea8e4f | 25 | Chemical lifespan is set to 50 hours of production and production time for each lot in tool is 1.5hrs */ |
saltire78 | 0:1a475dea8e4f | 26 | float lvlset=20.0, lvllo=15.0, lvlhi=23.0, lvlhihi=24.0; // tank level criteria - current level, setpoint, lowest level, high level, critical high |
saltire78 | 0:1a475dea8e4f | 27 | float tmpset=150.0, tmplo=130.0, tmphi=170.0, tmphihi=190.0; // tank temperature criteria - current temp, setpoint, lowest level, high level, critical high |
saltire78 | 0:1a475dea8e4f | 28 | float tanklife=50.0, prodtime=1.5; // production criteria - lifespan of chemicals, production time per lot |
saltire78 | 0:1a475dea8e4f | 29 | int ctf=0, cth, ctr, prodpres; // flags for clear to fill, clear to heat, clear to run, product in tank - in all cases clear is true |
saltire78 | 0:1a475dea8e4f | 30 | |
saltire78 | 0:1a475dea8e4f | 31 | // Interrupt program for Emergency Manual Overide activation |
saltire78 | 0:1a475dea8e4f | 32 | void override(){ |
saltire78 | 0:1a475dea8e4f | 33 | debounce.start(); // start the timer |
saltire78 | 0:1a475dea8e4f | 34 | invalve=0; // close input valve |
saltire78 | 0:1a475dea8e4f | 35 | outvalve=1; // dump tank |
saltire78 | 0:1a475dea8e4f | 36 | heatstir=0; // stop heater |
saltire78 | 0:1a475dea8e4f | 37 | ctf=0; // clear to fill to false |
saltire78 | 0:1a475dea8e4f | 38 | cth=0; // clear to heat to false |
saltire78 | 0:1a475dea8e4f | 39 | ctr=0; // clear to run to false |
saltire78 | 0:1a475dea8e4f | 40 | lcd.cls(); // clear LCD screen |
saltire78 | 0:1a475dea8e4f | 41 | lcd.locate(0,0); // home the lcd screen |
saltire78 | 0:1a475dea8e4f | 42 | lcd.printf("EMO activated!\nContact Equipment Group!\nDumping Tank"); //print emo text on LCD |
saltire78 | 0:1a475dea8e4f | 43 | pc.printf("EMO activated! Contact Equipment Group! Dumping Tank\n\r"); //print emo text on pc |
saltire78 | 0:1a475dea8e4f | 44 | if (debounce.read_ms() >= 500){ // determine the timer limits - greater than or equal incase the exact count was missed by timer |
saltire78 | 0:1a475dea8e4f | 45 | debounce.reset(); // reset the timer for the next use |
saltire78 | 0:1a475dea8e4f | 46 | } |
saltire78 | 0:1a475dea8e4f | 47 | |
saltire78 | 0:1a475dea8e4f | 48 | } |
saltire78 | 0:1a475dea8e4f | 49 | |
saltire78 | 0:1a475dea8e4f | 50 | // Interrupt program for Stop button activation |
saltire78 | 0:1a475dea8e4f | 51 | void halt(){ |
saltire78 | 0:1a475dea8e4f | 52 | debounce.start(); // start the timer |
saltire78 | 0:1a475dea8e4f | 53 | invalve=0; // close input valve |
saltire78 | 0:1a475dea8e4f | 54 | outvalve=0; // close output valve |
saltire78 | 0:1a475dea8e4f | 55 | heatstir=0; // stop heater |
saltire78 | 0:1a475dea8e4f | 56 | ctf=0; // clear to fill to false |
saltire78 | 0:1a475dea8e4f | 57 | cth=0; // clear to heat to false |
saltire78 | 0:1a475dea8e4f | 58 | ctr=0; // clear to run to false |
saltire78 | 0:1a475dea8e4f | 59 | lcd.cls(); // clear LCD screen |
saltire78 | 0:1a475dea8e4f | 60 | lcd.locate(0,0); // home the lcd screen |
saltire78 | 0:1a475dea8e4f | 61 | lcd.printf("Stop Pressed!\nContact Equipment Group!\nHold to verify"); //print stop text on LCD |
saltire78 | 0:1a475dea8e4f | 62 | pc.printf("Stop Pressed! Contact Equipment Group! Hold to verify production ok!\n\r"); //print stop text on pc |
saltire78 | 0:1a475dea8e4f | 63 | if (debounce.read_ms() >= 500){ // determine the timer limits - greater than or equal incase the exact count was missed by timer |
saltire78 | 0:1a475dea8e4f | 64 | debounce.reset(); // reset the timer for the next use |
saltire78 | 0:1a475dea8e4f | 65 | } |
saltire78 | 0:1a475dea8e4f | 66 | |
saltire78 | 0:1a475dea8e4f | 67 | } |
saltire78 | 0:1a475dea8e4f | 68 | |
saltire78 | 0:1a475dea8e4f | 69 | // Start of main program |
saltire78 | 0:1a475dea8e4f | 70 | int main(){ |
saltire78 | 0:1a475dea8e4f | 71 | // define emo interrupt |
saltire78 | 0:1a475dea8e4f | 72 | emo.rise(&override); //attach the function address to the rising edge |
saltire78 | 0:1a475dea8e4f | 73 | // define Stop interrupt |
saltire78 | 0:1a475dea8e4f | 74 | stop.rise(&halt); //attach the function address to the rising edge |
saltire78 | 0:1a475dea8e4f | 75 | |
saltire78 | 0:1a475dea8e4f | 76 | |
saltire78 | 0:1a475dea8e4f | 77 | while(1){ //always on loop |
saltire78 | 0:1a475dea8e4f | 78 | float level=25.0*lvl+0; //define the current tank level (y=mx+c) |
saltire78 | 0:1a475dea8e4f | 79 | float temperature=200.0*temp+0; //define the current tank temperature (y=mx+c) |
saltire78 | 0:1a475dea8e4f | 80 | |
saltire78 | 0:1a475dea8e4f | 81 | // initial start conditions are an error or a start button press |
saltire78 | 0:1a475dea8e4f | 82 | if(ctf==0 and prod==1){ //load error detected - product in tank/sensor failure |
saltire78 | 0:1a475dea8e4f | 83 | lcd.cls(); //clear LCD screen |
saltire78 | 0:1a475dea8e4f | 84 | lcd.locate(0,0); //error - home the lcd screen |
saltire78 | 0:1a475dea8e4f | 85 | lcd.printf("System Error!\nContact Equipment Group!\nProduct detected in tank!"); //error - print error text on LCD |
saltire78 | 0:1a475dea8e4f | 86 | pc.printf("System Error! - Contact Equipment Group! - Product detected in tank!\n\r"); //error - print error text via terraterm to pc |
saltire78 | 0:1a475dea8e4f | 87 | } |
saltire78 | 0:1a475dea8e4f | 88 | if(ctf==0 and start==1){ //start button goes true (momentary) |
saltire78 | 0:1a475dea8e4f | 89 | ctf=1; //clear to fill flag goes true (set) |
saltire78 | 0:1a475dea8e4f | 90 | lcd.cls(); //clear LCD screen |
saltire78 | 0:1a475dea8e4f | 91 | lcd.locate(0,0); //home LCD screen |
saltire78 | 0:1a475dea8e4f | 92 | lcd.printf("Start Button Pressed"); //print start text on LCD |
saltire78 | 0:1a475dea8e4f | 93 | pc.printf("Start Button Pressed\n\r"); //clear to fill flag goes true (set) - only stop/emo/dump will unset this |
saltire78 | 0:1a475dea8e4f | 94 | wait(0.5); //debounce delay |
saltire78 | 0:1a475dea8e4f | 95 | } |
saltire78 | 0:1a475dea8e4f | 96 | |
saltire78 | 0:1a475dea8e4f | 97 | //if cleared to fill various states are possible based upon volume detected |
saltire78 | 0:1a475dea8e4f | 98 | if(ctf==1){ //clearance given to run |
saltire78 | 0:1a475dea8e4f | 99 | |
saltire78 | 0:1a475dea8e4f | 100 | if(level<lvllo){ //tank below lowest usable level |
saltire78 | 0:1a475dea8e4f | 101 | invalve=1; //open the input valve |
saltire78 | 0:1a475dea8e4f | 102 | outvalve=0; //close the output valve |
saltire78 | 0:1a475dea8e4f | 103 | cth=0; //heat/stir flag set to false |
saltire78 | 0:1a475dea8e4f | 104 | lcd.cls(); //LCD screen cleared |
saltire78 | 0:1a475dea8e4f | 105 | lcd.locate(0,0); //LCD homed |
saltire78 | 0:1a475dea8e4f | 106 | lcd.printf("Level: %2.1f\nTemp: %3.1f\nTank Filling",level,temperature); //status to LCD |
saltire78 | 0:1a475dea8e4f | 107 | pc.printf("Tank level: %2.1f, Tank temperature: %3.1f, Tank filling\n\r",level,temperature); //status to pc |
saltire78 | 0:1a475dea8e4f | 108 | wait(1); //pause for 1 second to prevent flood of data |
saltire78 | 0:1a475dea8e4f | 109 | } |
saltire78 | 0:1a475dea8e4f | 110 | else if(level<lvlset){ //minimum usable volume reached, heating now allowed |
saltire78 | 0:1a475dea8e4f | 111 | invalve=1; //filling to setpoint |
saltire78 | 0:1a475dea8e4f | 112 | outvalve=0; //closed output valve |
saltire78 | 0:1a475dea8e4f | 113 | cth=0; //clear to heat flag goes true (set) |
saltire78 | 0:1a475dea8e4f | 114 | lcd.cls(); //LCD screen cleared |
saltire78 | 0:1a475dea8e4f | 115 | lcd.locate(0,0); //LCD homed |
saltire78 | 0:1a475dea8e4f | 116 | lcd.printf("Level: %2.1f\nTemp: %3.1f\nTank Level Low",level,temperature); //status to LCD |
saltire78 | 0:1a475dea8e4f | 117 | pc.printf("Tank level: %2.1f, Tank temperature: %3.1f, Tank level low\n\r",level,temperature); //status to pc |
saltire78 | 0:1a475dea8e4f | 118 | wait(1); //pause for 1 second to prevent flood of data |
saltire78 | 0:1a475dea8e4f | 119 | } |
saltire78 | 0:1a475dea8e4f | 120 | else if(level<lvlhi){ //volume setpoint reached |
saltire78 | 0:1a475dea8e4f | 121 | invalve=0; //input valve closed |
saltire78 | 0:1a475dea8e4f | 122 | outvalve=0; //output valve remains closed |
saltire78 | 0:1a475dea8e4f | 123 | cth=1; //clear to fill flag remains true |
saltire78 | 0:1a475dea8e4f | 124 | lcd.cls(); //LCD screen cleared |
saltire78 | 0:1a475dea8e4f | 125 | lcd.locate(0,0); //LCD homed |
saltire78 | 0:1a475dea8e4f | 126 | lcd.printf("Level: %2.1f\nTemp: %3.1f\nAt Level Setpoint",level,temperature); //status to LCD |
saltire78 | 0:1a475dea8e4f | 127 | pc.printf("Tank level: %2.1f, Tank temperature: %3.1f, Tank at level setpoint\n\r",level,temperature); //status to pc |
saltire78 | 0:1a475dea8e4f | 128 | wait(1); //pause for 1 second to prevent flood of data |
saltire78 | 0:1a475dea8e4f | 129 | } |
saltire78 | 0:1a475dea8e4f | 130 | else if(level<lvlhihi){ //warning state - volume goes high enough to flag - possible ceased input valve/system error |
saltire78 | 0:1a475dea8e4f | 131 | invalve=0; //input valve off command reconfirmed |
saltire78 | 0:1a475dea8e4f | 132 | outvalve=1; //output valve opened to release volume |
saltire78 | 0:1a475dea8e4f | 133 | cth=0; //clear to heat flag goes false (set) |
saltire78 | 0:1a475dea8e4f | 134 | lcd.cls(); //LCD screen cleared |
saltire78 | 0:1a475dea8e4f | 135 | lcd.locate(0,0); //LCD homed |
saltire78 | 0:1a475dea8e4f | 136 | lcd.printf("Level: %2.1f\nTemp: %3.1f\nTank Level High!",level,temperature); //status to LCD |
saltire78 | 0:1a475dea8e4f | 137 | pc.printf("Tank level: %2.1f, Tank temperature: %3.1f, Tank Level High Warning!\n\r",level,temperature); //status to pc |
saltire78 | 0:1a475dea8e4f | 138 | wait(1); //pause for 1 second to prevent flood of data |
saltire78 | 0:1a475dea8e4f | 139 | } |
saltire78 | 0:1a475dea8e4f | 140 | else if(lvlhihi<=level){ //critical state - critical volume detected, overflow risk - emergency dump |
saltire78 | 0:1a475dea8e4f | 141 | invalve=0; // input valve closed |
saltire78 | 0:1a475dea8e4f | 142 | outvalve=1; //output valve open to dump |
saltire78 | 0:1a475dea8e4f | 143 | cth=0; //clear to heat flag remains false |
saltire78 | 0:1a475dea8e4f | 144 | ctf=0; //clear to fill flag goes false - tool returned to start conditions |
saltire78 | 0:1a475dea8e4f | 145 | lcd.cls(); //LCD screen cleared |
saltire78 | 0:1a475dea8e4f | 146 | lcd.locate(0,0); //LCD homed |
saltire78 | 0:1a475dea8e4f | 147 | lcd.printf("Level: %2.1f\nTemp: %3.1f\nLevel Critical! Tank Dump",level,temperature); //status to LCD |
saltire78 | 0:1a475dea8e4f | 148 | pc.printf("Tank level: %2.1f, Tank temperature: %3.1f, Tank Overflow Risk! Dumping Tank\n\r",level,temperature); //status to pc |
saltire78 | 0:1a475dea8e4f | 149 | wait(1); //pause for 1 second to prevent flood of data |
saltire78 | 0:1a475dea8e4f | 150 | } |
saltire78 | 0:1a475dea8e4f | 151 | } |
saltire78 | 0:1a475dea8e4f | 152 | |
saltire78 | 0:1a475dea8e4f | 153 | //if cleared to heat various states are possible based upon volume detected |
saltire78 | 0:1a475dea8e4f | 154 | if(cth==1){ //clearance given to run heater/stirrer |
saltire78 | 0:1a475dea8e4f | 155 | |
saltire78 | 0:1a475dea8e4f | 156 | if(temperature<tmplo){ //tank below lowest usable temperature |
saltire78 | 0:1a475dea8e4f | 157 | heatstir=1; //turn on the heater/stirrer |
saltire78 | 0:1a475dea8e4f | 158 | ctr=0; //clear to run flag set to false |
saltire78 | 0:1a475dea8e4f | 159 | lcd.cls(); //LCD screen cleared |
saltire78 | 0:1a475dea8e4f | 160 | lcd.locate(0,0); //LCD homed |
saltire78 | 0:1a475dea8e4f | 161 | lcd.printf("Level: %2.1f\nTemp: %3.1f\nTank Heating",level,temperature); //status to LCD |
saltire78 | 0:1a475dea8e4f | 162 | pc.printf("Tank level: %2.1f, Tank temperature: %3.1f, Tank Temperature Low, Heater on\n\r",level,temperature); //status to pc |
saltire78 | 0:1a475dea8e4f | 163 | wait(1); //pause for 1 second to prevent flood of data |
saltire78 | 0:1a475dea8e4f | 164 | } |
saltire78 | 0:1a475dea8e4f | 165 | else if(temperature<tmpset){ //minimum usable temperature reached, running now allowed |
saltire78 | 0:1a475dea8e4f | 166 | heatstir=1; //heating to setpoint |
saltire78 | 0:1a475dea8e4f | 167 | ctr=1; //clear to run flag goes true (set) |
saltire78 | 0:1a475dea8e4f | 168 | sysrun=1; //output to system to begin loading product |
saltire78 | 0:1a475dea8e4f | 169 | lcd.cls(); //LCD screen cleared |
saltire78 | 0:1a475dea8e4f | 170 | lcd.locate(0,0); //LCD homed |
saltire78 | 0:1a475dea8e4f | 171 | lcd.printf("Level: %2.1f\nTemp: %3.1f\nTemp Low",level,temperature); //status to LCD |
saltire78 | 0:1a475dea8e4f | 172 | pc.printf("Tank level: %2.1f, Tank temperature: %3.1f, Temperaturelow, ok to run\n\r",level,temperature); //status to pc |
saltire78 | 0:1a475dea8e4f | 173 | wait(1); //pause for 1 second to prevent flood of data |
saltire78 | 0:1a475dea8e4f | 174 | } |
saltire78 | 0:1a475dea8e4f | 175 | else if(temperature<tmphi){ //temp setpoint reached |
saltire78 | 0:1a475dea8e4f | 176 | heatstir=0; //heater off |
saltire78 | 0:1a475dea8e4f | 177 | ctr=1; //clear to run flag remains true |
saltire78 | 0:1a475dea8e4f | 178 | sysrun=1; //output to system to begin loading product |
saltire78 | 0:1a475dea8e4f | 179 | lcd.cls(); //LCD screen cleared |
saltire78 | 0:1a475dea8e4f | 180 | lcd.locate(0,0); //LCD homed |
saltire78 | 0:1a475dea8e4f | 181 | lcd.printf("Level: %2.1f\nTemp: %3.1f\nTemp at Setpoint",level,temperature); //status to LCD |
saltire78 | 0:1a475dea8e4f | 182 | pc.printf("Tank level: %2.1f, Tank temperature: %3.1f, Tank at temperature setpoint\n\r",level,temperature); //status to pc |
saltire78 | 0:1a475dea8e4f | 183 | wait(1); //pause for 1 second to prevent flood of data |
saltire78 | 0:1a475dea8e4f | 184 | } |
saltire78 | 0:1a475dea8e4f | 185 | else if(temperature<tmphihi){ //warning state - temp goes high enough to flag - possible ceased heater/system error |
saltire78 | 0:1a475dea8e4f | 186 | heatstir=0; //input valve off command reconfirmed |
saltire78 | 0:1a475dea8e4f | 187 | ctr=0; //clear to heat flag goes false (set) |
saltire78 | 0:1a475dea8e4f | 188 | lcd.cls(); //LCD screen cleared |
saltire78 | 0:1a475dea8e4f | 189 | lcd.locate(0,0); //LCD homed |
saltire78 | 0:1a475dea8e4f | 190 | lcd.printf("Level: %2.1f\nTemp: %3.1f\nTemp High!",level,temperature); //status to LCD |
saltire78 | 0:1a475dea8e4f | 191 | pc.printf("Tank level: %2.1f, Tank temperature: %3.1f, Tank Temperature High Warning!\n\r",level,temperature); //status to pc |
saltire78 | 0:1a475dea8e4f | 192 | wait(1); //pause for 1 second to prevent flood of data |
saltire78 | 0:1a475dea8e4f | 193 | } |
saltire78 | 0:1a475dea8e4f | 194 | else if(tmphihi<=temperature){ //critical state - critical volume detected, overflow risk - emergency dump |
saltire78 | 0:1a475dea8e4f | 195 | heatstir=0; // input valve closed |
saltire78 | 0:1a475dea8e4f | 196 | ctr=0; //clear to run flag goes false |
saltire78 | 0:1a475dea8e4f | 197 | cth=0; //clear to heat flag goes false |
saltire78 | 0:1a475dea8e4f | 198 | ctf=0; //clear to fill flag goes false - tool returned to start conditions |
saltire78 | 0:1a475dea8e4f | 199 | lcd.cls(); //LCD screen cleared |
saltire78 | 0:1a475dea8e4f | 200 | lcd.locate(0,0); //LCD homed |
saltire78 | 0:1a475dea8e4f | 201 | lcd.printf("Level: %2.1f\nTemp: %3.1f\nTemp Critical! Tank Dump",level,temperature); //status to LCD |
saltire78 | 0:1a475dea8e4f | 202 | pc.printf("Tank level: %2.1f, Tank temperature: %3.1f, Tank Overheated, Production Risk! Dumping Tank\n\r",level,temperature); //status to pc |
saltire78 | 0:1a475dea8e4f | 203 | wait(1); //pause for 1 second to prevent flood of data |
saltire78 | 0:1a475dea8e4f | 204 | } |
saltire78 | 0:1a475dea8e4f | 205 | } |
saltire78 | 0:1a475dea8e4f | 206 | |
saltire78 | 0:1a475dea8e4f | 207 | if(ctr==1){ //clearance given to run heater/stirrer |
saltire78 | 0:1a475dea8e4f | 208 | if(prod==1){ //when product arrives at station and triggers sensor |
saltire78 | 0:1a475dea8e4f | 209 | tanklife-=prodtime; //chemical time is reduced by set amount of production time |
saltire78 | 0:1a475dea8e4f | 210 | } |
saltire78 | 0:1a475dea8e4f | 211 | lcd.cls(); //LCD screen cleared |
saltire78 | 0:1a475dea8e4f | 212 | lcd.locate(0,0); //LCD homed |
saltire78 | 0:1a475dea8e4f | 213 | lcd.printf("Level: %2.1f L\nTemp: %3.1f C\nChem Time: %3.1f Hrs",level,temperature,tanklife); //status to LCD |
saltire78 | 0:1a475dea8e4f | 214 | pc.printf("Tank level: %2.1f, Tank temperature: %3.1f, Remaining Chem hours: %3.1f\n\r",level,temperature,tanklife); //status to pc |
saltire78 | 0:1a475dea8e4f | 215 | wait(1); //clearance given to run heater/stirrer |
saltire78 | 0:1a475dea8e4f | 216 | } |
saltire78 | 0:1a475dea8e4f | 217 | |
saltire78 | 0:1a475dea8e4f | 218 | if(tanklife<=0){ //when usable lifespan of chemical expires |
saltire78 | 0:1a475dea8e4f | 219 | ctr=0; //clear to run flag goes false |
saltire78 | 0:1a475dea8e4f | 220 | cth=0; //clear to heat flag goes false |
saltire78 | 0:1a475dea8e4f | 221 | ctf=0; //clear to fill flag goes false |
saltire78 | 0:1a475dea8e4f | 222 | sysrun=0; //command to run production rescinded |
saltire78 | 0:1a475dea8e4f | 223 | lcd.cls(); //LCD screen cleared |
saltire78 | 0:1a475dea8e4f | 224 | lcd.locate(0,0); //LCD homed |
saltire78 | 0:1a475dea8e4f | 225 | lcd.printf("Level: %2.1f\nTemp: %3.1f\nChem Time Over, Dump!",level,temperature); //status to LCD |
saltire78 | 0:1a475dea8e4f | 226 | pc.printf("Tank level: %2.1f, Tank temperature: %3.1f, Chemical time limit expired! Dumping Tank\n\r",level,temperature); //status to pc |
saltire78 | 0:1a475dea8e4f | 227 | wait(1); //pause for 1 second to prevent flood of data |
saltire78 | 0:1a475dea8e4f | 228 | } |
saltire78 | 0:1a475dea8e4f | 229 | |
saltire78 | 0:1a475dea8e4f | 230 | |
saltire78 | 0:1a475dea8e4f | 231 | } // while loop end |
saltire78 | 0:1a475dea8e4f | 232 | } // main end |