rendered paste body//************************************************************************************//** //** File name: C:\Documents and Settings\Skeeter\My Documents\Control.c//** Generated by: Flowcode v4.0.0.53//** Date: Monday, October 26, 2009 21:10:07//** Licence: Demo//** //** ***DEMO VERSION***//** //** //** NOT FOR COMMERCIAL USE//** //** http://www.matrixmultimedia.com//************************************************************************************#define MX_PIC//Defines for microcontroller#define P16F690#define MX_EE#define MX_EE_SIZE 256#define MX_SPI#define MX_SPI_BCB#define MX_SPI_SDI 4#define MX_SPI_SDO 7#define MX_SPI_SCK 6#define MX_UART#define MX_UART_B#define MX_UART_TX 7#define MX_UART_RX 5#define MX_I2C#define MX_MI2C#define MX_I2C_B#define MX_I2C_SDA 4#define MX_I2C_SCL 6#define MX_PWM#define MX_PWM_CNT 1#define MX_PWM_TRIS1 trisc#define MX_PWM_1 5//Functions#include <system.h>#pragma CLOCK_FREQ 5000000//Configuration data#pragma DATA 0x2007, 0x3bf1//Internal functions#include "C:\Flowcode V4\FCD\internals.h"//Macro function declarationsvoid FCM_Refill();//Variable declarationsshort FCV_TIMEOUT;char FCV_UPPERSENSOR;char FCV_OUTPUTS;char FCV_LOWERSENSOR;char FCV_MODE1;char FCV_MODE2;char FCV_TIMEOUTSETTING;short FCV_RESULT;char FCV_MODE3;//Defines:/**** Macro Substitutions ****0 = Which ADC Channel40 = Acquisition time3 = Conversion Speed0 = VRef+ Option500 = VRef Voltage x 0.01V******************************///ADC0: //Macro function declarationsvoid FCD_ADC0_SampleADC();char FCD_ADC0_ReadAsByte();short FCD_ADC0_ReadAsInt();float FCD_ADC0_ReadAsVoltage();void FCD_ADC0_ReadAsString(char* FCR_RETVAL, char FCR_RETVAL_SIZE, char NumBytes);//Defines:/**** Macro Substitutions ****portb = D1 Porttrisb = D1 Data Directionportb = D2 Porttrisb = D2 Data Directionportb = D3 Porttrisb = D3 Data Directionportb = D4 Porttrisb = D4 Data Directionportb = RS Porttrisb = RS Data Directionportb = E Porttrisb = E Data Direction/ = Data 1_Pin/ = Data 2 Pin4 = Data 3 Pin5 = Data 4 Pin/ = RS Pin/ = Enable PinLCD_2097944 = Unique Component Reference Number2 = Row Count16 = Column Count******************************/ //component connections #define LCD_2097944_PORT0 portb #define LCD_2097944_TRIS0 trisb #define LCD_2097944_PORT1 portb #define LCD_2097944_TRIS1 trisb #define LCD_2097944_PORT2 portb #define LCD_2097944_TRIS2 trisb #define LCD_2097944_PORT3 portb #define LCD_2097944_TRIS3 trisb #define LCD_2097944_PORT4 portb #define LCD_2097944_TRIS4 trisb #define LCD_2097944_PORT5 portb #define LCD_2097944_TRIS5 trisb #define LCD_2097944_BIT0 / #define LCD_2097944_BIT1 / #define LCD_2097944_BIT2 4 #define LCD_2097944_BIT3 5 #define LCD_2097944_RS / #define LCD_2097944_E / #define LCD_2097944_ROWCNT 2 #define LCD_2097944_COLCNT 16 #ifdef _BOOSTC #define LCD_2097944_DELAY delay_10us(10) #endif #ifdef _C2C_ #define LCD_2097944_DELAY delay_us(100) #endif #ifndef LCD_2097944_DELAY #define LCD_2097944_DELAY delay_us(100) #endif//LCDDisplay0: //Macro function declarationsvoid FCD_LCDDisplay0_RawSend(char in, char mask);void FCD_LCDDisplay0_Start();void FCD_LCDDisplay0_Clear();void FCD_LCDDisplay0_PrintASCII(char Character);void FCD_LCDDisplay0_Command(char in);void FCD_LCDDisplay0_Cursor(char x, char y);void FCD_LCDDisplay0_PrintNumber(short Number);void FCD_LCDDisplay0_PrintString(char* String, char MSZ_String);void FCD_LCDDisplay0_ScrollDisplay(char Direction, char Num_Positions);void FCD_LCDDisplay0_ClearLine(char Line);void FCD_LCDDisplay0_RAM_Write(char nIdx, char d0, char d1, char d2, char d3, char d4, char d5, char d6, char d7);//ADC0: //Macro implementationsvoid FCD_ADC0_SampleADC(){ /*******Supported Devices****************************************************************** // 16F616, 16F676, 16F677, 16F684, 16F685, 16F687, 16F688, 16F689, 16F690 ******************************************************************************************/ #define MX_ADC_CHANNEL 0 #define MX_ADC_SAMP_TIME 40 #define MX_ADC_CONV_SP 3 #define MX_ADC_VREF_OPT 0 //set up ADC conversion char old_tris, cnt; //assign conversion rate adcon1 = ((MX_ADC_CONV_SP & 0x07) << 4); //find appropriate bit #if (MX_ADC_CHANNEL == 0) #define MX_ADC_TRIS_REG trisa #define MX_ADC_TRIS_MSK 0x01 ansel = 0x01; #endif #if (MX_ADC_CHANNEL == 1) #define MX_ADC_TRIS_REG trisa #define MX_ADC_TRIS_MSK 0x02 ansel = 0x02; #if (MX_ADC_VREF_OPT == 1) #pragma error "Target device is currently using AN1 for VREF+" #endif #endif #if (MX_ADC_CHANNEL == 2) #define MX_ADC_TRIS_REG trisa #define MX_ADC_TRIS_MSK 0x04 ansel = 0x04; #endif #if (MX_ADC_CHANNEL == 3) #define MX_ADC_TRIS_REG trisa #define MX_ADC_TRIS_MSK 0x10 ansel = 0x08; #endif #if (MX_ADC_CHANNEL == 4) #define MX_ADC_TRIS_REG trisc #define MX_ADC_TRIS_MSK 0x01 ansel = 0x10; #endif #if (MX_ADC_CHANNEL == 5) #define MX_ADC_TRIS_REG trisc #define MX_ADC_TRIS_MSK 0x02 ansel = 0x20; #endif #if (MX_ADC_CHANNEL == 6) #define MX_ADC_TRIS_REG trisc #define MX_ADC_TRIS_MSK 0x04 ansel = 0x40; #endif #if (MX_ADC_CHANNEL == 7) #define MX_ADC_TRIS_REG trisc #define MX_ADC_TRIS_MSK 0x08 ansel = 0x80; #endif #if (MX_ADC_CHANNEL == 8) #define MX_ADC_TRIS_REG trisc #define MX_ADC_TRIS_MSK 0x40 anselh = 0x01; #endif #if (MX_ADC_CHANNEL == 9) #define MX_ADC_TRIS_REG trisc #define MX_ADC_TRIS_MSK 0x80 anselh = 0x02; #endif #if (MX_ADC_CHANNEL == 10) #define MX_ADC_TRIS_REG trisb #define MX_ADC_TRIS_MSK 0x10 anselh = 0x04; #endif #if (MX_ADC_CHANNEL == 11) #define MX_ADC_TRIS_REG trisb #define MX_ADC_TRIS_MSK 0x20 anselh = 0x08; #endif //sanity check #ifndef MX_ADC_TRIS_REG #pragma error "ADC Type 3 conversion code error - please contact technical support" #endif //store old tris value, and set the i/o pin as an input old_tris = MX_ADC_TRIS_REG; MX_ADC_TRIS_REG = MX_ADC_TRIS_REG | MX_ADC_TRIS_MSK; //turn ADC on adcon0 = 0x01 | (MX_ADC_CHANNEL << 2); //assign VREF functionality #if (MX_ADC_VREF_OPT == 1) set_bit(adcon0, VCFG); #endif //wait the acquisition time cnt = 0; while (cnt < MX_ADC_SAMP_TIME) cnt++; //begin conversion and wait until it has finished adcon0 = adcon0 | 0x02; while (adcon0 & 0x02); //restore old tris value, and reset adc registers MX_ADC_TRIS_REG = old_tris; ansel = 0x00; adcon0 = 0x00; #if(anselh) anselh = 0x00; #endif #undef MX_ADC_TRIS_REG #undef MX_ADC_TRIS_MSK #undef MX_ADC_SAMP_TIME #undef MX_ADC_CHANNEL #undef MX_ADC_CONV_SP #undef MX_ADC_VREF_OPT}char FCD_ADC0_ReadAsByte(){ FCD_ADC0_SampleADC(); return adresh;}short FCD_ADC0_ReadAsInt(){ short iRetVal; FCD_ADC0_SampleADC(); iRetVal = (adresh << 2); iRetVal = iRetVal | (adresl >> 6); return (iRetVal);}float FCD_ADC0_ReadAsVoltage(){ int iSample; float fSample, fVoltage, fVperDiv; #define MX_ADC_VREF_V 500 iSample = FCD_ADC0_ReadAsInt(); //Read as 10-bit Integer fVoltage = float32_from_int32(MX_ADC_VREF_V); //Convert reference voltage count to floating point (0 - 500 x 10mV) fVoltage = float32_mul(fVoltage, 0.01); //Convert reference voltage count to actual voltage (0 - 5) fVperDiv = float32_mul(fVoltage, 0.000976); //Convert actual voltage to voltage per division (VRef / 1024) fSample = float32_from_int32(iSample); //Convert to floating point variable fVoltage = float32_mul(fSample, fVperDiv); //Calculate floating point voltage #undef MX_ADC_VREF_V return (fVoltage);}void FCD_ADC0_ReadAsString(char* FCR_RETVAL, char FCR_RETVAL_SIZE, char NumBytes){ float fVoltage; if (NumBytes > FCR_RETVAL_SIZE) NumBytes = FCR_RETVAL_SIZE; fVoltage = FCD_ADC0_ReadAsVoltage(); FCI_FLOAT_TO_STRING(fVoltage, 2, FCR_RETVAL, NumBytes); //Convert to String}//LCDDisplay0: //Macro implementationsvoid FCD_LCDDisplay0_RawSend(char in, char mask){ unsigned char pt; clear_bit(LCD_2097944_PORT0, LCD_2097944_BIT0); clear_bit(LCD_2097944_PORT1, LCD_2097944_BIT1); clear_bit(LCD_2097944_PORT2, LCD_2097944_BIT2); clear_bit(LCD_2097944_PORT3, LCD_2097944_BIT3); clear_bit(LCD_2097944_PORT4, LCD_2097944_RS); clear_bit(LCD_2097944_PORT5, LCD_2097944_E); pt = ((in >> 4) & 0x0f); if (pt & 0x01) set_bit(LCD_2097944_PORT0, LCD_2097944_BIT0); if (pt & 0x02) set_bit(LCD_2097944_PORT1, LCD_2097944_BIT1); if (pt & 0x04) set_bit(LCD_2097944_PORT2, LCD_2097944_BIT2); if (pt & 0x08) set_bit(LCD_2097944_PORT3, LCD_2097944_BIT3); if (mask) set_bit(LCD_2097944_PORT4, LCD_2097944_RS); LCD_2097944_DELAY; set_bit (LCD_2097944_PORT5, LCD_2097944_E); LCD_2097944_DELAY; clear_bit (LCD_2097944_PORT5, LCD_2097944_E); pt = (in & 0x0f); LCD_2097944_DELAY; clear_bit(LCD_2097944_PORT0, LCD_2097944_BIT0); clear_bit(LCD_2097944_PORT1, LCD_2097944_BIT1); clear_bit(LCD_2097944_PORT2, LCD_2097944_BIT2); clear_bit(LCD_2097944_PORT3, LCD_2097944_BIT3); clear_bit(LCD_2097944_PORT4, LCD_2097944_RS); clear_bit(LCD_2097944_PORT5, LCD_2097944_E); if (pt & 0x01) set_bit(LCD_2097944_PORT0, LCD_2097944_BIT0); if (pt & 0x02) set_bit(LCD_2097944_PORT1, LCD_2097944_BIT1); if (pt & 0x04) set_bit(LCD_2097944_PORT2, LCD_2097944_BIT2); if (pt & 0x08) set_bit(LCD_2097944_PORT3, LCD_2097944_BIT3); if (mask) set_bit(LCD_2097944_PORT4, LCD_2097944_RS); LCD_2097944_DELAY; set_bit (LCD_2097944_PORT5, LCD_2097944_E); LCD_2097944_DELAY; clear_bit (LCD_2097944_PORT5, LCD_2097944_E); LCD_2097944_DELAY;}void FCD_LCDDisplay0_Start(){ clear_bit(LCD_2097944_TRIS0, LCD_2097944_BIT0); clear_bit(LCD_2097944_TRIS1, LCD_2097944_BIT1); clear_bit(LCD_2097944_TRIS2, LCD_2097944_BIT2); clear_bit(LCD_2097944_TRIS3, LCD_2097944_BIT3); clear_bit(LCD_2097944_TRIS4, LCD_2097944_RS); clear_bit(LCD_2097944_TRIS5, LCD_2097944_E); Wdt_Delay_Ms(12); FCD_LCDDisplay0_RawSend(0x33, 0); Wdt_Delay_Ms(2); FCD_LCDDisplay0_RawSend(0x33, 0); Wdt_Delay_Ms(2); FCD_LCDDisplay0_RawSend(0x32, 0); Wdt_Delay_Ms(2); FCD_LCDDisplay0_RawSend(0x2c, 0); Wdt_Delay_Ms(2); FCD_LCDDisplay0_RawSend(0x06, 0); Wdt_Delay_Ms(2); FCD_LCDDisplay0_RawSend(0x0c, 0); Wdt_Delay_Ms(2); //clear the display FCD_LCDDisplay0_RawSend(0x01, 0); Wdt_Delay_Ms(2); FCD_LCDDisplay0_RawSend(0x02, 0); Wdt_Delay_Ms(2);}void FCD_LCDDisplay0_Clear(){ FCD_LCDDisplay0_RawSend(0x01, 0); Wdt_Delay_Ms(2); FCD_LCDDisplay0_RawSend(0x02, 0); Wdt_Delay_Ms(2);}void FCD_LCDDisplay0_PrintASCII(char Character){ FCD_LCDDisplay0_RawSend(Character, 0x10);}void FCD_LCDDisplay0_Command(char in){ FCD_LCDDisplay0_RawSend(in, 0); Wdt_Delay_Ms(2);}void FCD_LCDDisplay0_Cursor(char x, char y){ #if (LCD_2097944_ROWCNT == 1) y=0x80; #endif #if (LCD_2097944_ROWCNT == 2) if (y==0) y=0x80; else y=0xc0; #endif #if (LCD_2097944_ROWCNT == 4) if (y==0) y=0x80; else if (y==1) y=0xc0; #if (LCD_2097944_COLCNT == 16) else if (y==2) y=0x90; else y=0xd0; #endif #if (LCD_2097944_COLCNT == 20) else if (y==2) y=0x94; else y=0xd4; #endif #endif FCD_LCDDisplay0_RawSend(y+x, 0); Wdt_Delay_Ms(2);}void FCD_LCDDisplay0_PrintNumber(short Number){ short tmp_int; char tmp_byte; if (Number < 0) { FCD_LCDDisplay0_RawSend('-', 0x10); Number = 0 - Number; } tmp_int = Number; if (Number >= 10000) { tmp_byte = tmp_int / 10000; FCD_LCDDisplay0_RawSend('0' + tmp_byte, 0x10); while (tmp_byte > 0) { tmp_int = tmp_int - 10000; tmp_byte--; } } if (Number >= 1000) { tmp_byte = tmp_int / 1000; FCD_LCDDisplay0_RawSend('0' + tmp_byte, 0x10); while (tmp_byte > 0) { tmp_int = tmp_int - 1000; tmp_byte--; } } if (Number >= 100) { tmp_byte = tmp_int / 100; FCD_LCDDisplay0_RawSend('0' + tmp_byte, 0x10); while (tmp_byte > 0) { tmp_int = tmp_int - 100; tmp_byte--; } } if (Number >= 10) { tmp_byte = tmp_int / 10; FCD_LCDDisplay0_RawSend('0' + tmp_byte, 0x10); while (tmp_byte > 0) { tmp_int = tmp_int - 10; tmp_byte--; } } FCD_LCDDisplay0_RawSend('0' + tmp_int, 0x10);}void FCD_LCDDisplay0_PrintString(char* String, char MSZ_String){ char idx; for (idx=0; idx<MSZ_String; idx++) { if (String[idx]==0) { break; } FCD_LCDDisplay0_RawSend(String[idx], 0x10); }}void FCD_LCDDisplay0_ScrollDisplay(char Direction, char Num_Positions){ char cmd = 0; char count; //Choose the direction switch (Direction) { case 0: case 'l': case 'L': cmd = 0x18; break; case 1: case 'r': case 'R': cmd = 0x1C; break; default: break; } //If direction accepted then scroll the specified amount if (cmd) { for (count = 0; count < Num_Positions; count++) FCD_LCDDisplay0_Command(cmd); }}void FCD_LCDDisplay0_ClearLine(char Line){ char count; char rowcount; //Define number of columns per line #if (LCD_2097944_ROWCNT == 1) rowcount=80; #endif #if (LCD_2097944_ROWCNT == 2) rowcount=40; #endif #if (LCD_2097944_ROWCNT == 4) #if (LCD_2097944_COLCNT == 16) rowcount=16; #endif #if (LCD_2097944_COLCNT == 20) rowcount=20; #endif #endif //Start at beginning of the line FCD_LCDDisplay0_Cursor (0, Line); //Send out spaces to clear line for (count = 0; count < rowcount; count++) FCD_LCDDisplay0_RawSend(' ', 0x10); //Move back to the beginning of the line. FCD_LCDDisplay0_Cursor (0, Line);}void FCD_LCDDisplay0_RAM_Write(char nIdx, char d0, char d1, char d2, char d3, char d4, char d5, char d6, char d7){ //set CGRAM address FCD_LCDDisplay0_RawSend(64 + (nIdx << 3), 0); delay_ms(2); //write CGRAM data FCD_LCDDisplay0_RawSend(d0, 0x10); FCD_LCDDisplay0_RawSend(d1, 0x10); FCD_LCDDisplay0_RawSend(d2, 0x10); FCD_LCDDisplay0_RawSend(d3, 0x10); FCD_LCDDisplay0_RawSend(d4, 0x10); FCD_LCDDisplay0_RawSend(d5, 0x10); FCD_LCDDisplay0_RawSend(d6, 0x10); FCD_LCDDisplay0_RawSend(d7, 0x10); //Clear the display FCD_LCDDisplay0_RawSend(0x01, 0); delay_ms(2); FCD_LCDDisplay0_RawSend(0x02, 0); delay_ms(2);}//Macro implementationsvoid FCM_Refill(){ //Activates Refill Sub-Circuit //Call Component Macro //Call Component Macro: Result=ADC(0)::ReadAsInt FCV_RESULT = FCD_ADC0_ReadAsInt(); //Calculation //Calculation: // Timeout = ((Result+1)/17)/2 FCV_TIMEOUT = ((FCV_RESULT+1)/17)/2; //Loop //Loop: While UpperSensor <1 while (1) { //Decision //Decision: Mode3 > 0? if (FCV_MODE3 > 0) { } else { //Decision //Decision: Mode2 > 0? if (FCV_MODE2 > 0) { //Calculation //Calculation: // Mode2 = Mode2 - 1 FCV_MODE2 = FCV_MODE2 - 1; } //Call Component Macro //Call Component Macro: LCDDisplay(0)::ClearLine(1) FCD_LCDDisplay0_ClearLine(1); //Call Component Macro //Call Component Macro: LCDDisplay(0)::PrintASCII("Refilling Cell") FCD_LCDDisplay0_PrintASCII('R'); FCD_LCDDisplay0_PrintASCII('e'); FCD_LCDDisplay0_PrintASCII('f'); FCD_LCDDisplay0_PrintASCII('i'); FCD_LCDDisplay0_PrintASCII('l'); FCD_LCDDisplay0_PrintASCII('l'); FCD_LCDDisplay0_PrintASCII('i'); FCD_LCDDisplay0_PrintASCII('n'); FCD_LCDDisplay0_PrintASCII('g'); FCD_LCDDisplay0_PrintASCII(' '); FCD_LCDDisplay0_PrintASCII('C'); FCD_LCDDisplay0_PrintASCII('e'); FCD_LCDDisplay0_PrintASCII('l'); FCD_LCDDisplay0_PrintASCII('l'); //Calculation //Calculation: // Mode3 = Mode3 + 1 FCV_MODE3 = FCV_MODE3 + 1; //Output //Output: 0x06 -> PORT B trisb = 0x00; portb = 0x06; } //Input //Input: A1 -> UpperSensor trisa = trisa | 0x02; FCV_UPPERSENSOR = ((porta & 0x02) == 0x02); if ((FCV_UPPERSENSOR <1) == 0) break; } //Calculation //Calculation: // Mode3 = Mode3 - 1 FCV_MODE3 = FCV_MODE3 - 1; //Output //Output: 0 -> PORT B trisb = 0x00; portb = 0; //Call Component Macro //Call Component Macro: LCDDisplay(0)::ClearLine(1) FCD_LCDDisplay0_ClearLine(1); //Call Component Macro //Call Component Macro: LCDDisplay(0)::PrintASCII("Refill Complete") FCD_LCDDisplay0_PrintASCII('R'); FCD_LCDDisplay0_PrintASCII('e'); FCD_LCDDisplay0_PrintASCII('f'); FCD_LCDDisplay0_PrintASCII('i'); FCD_LCDDisplay0_PrintASCII('l'); FCD_LCDDisplay0_PrintASCII('l'); FCD_LCDDisplay0_PrintASCII(' '); FCD_LCDDisplay0_PrintASCII('C'); FCD_LCDDisplay0_PrintASCII('o'); FCD_LCDDisplay0_PrintASCII('m'); FCD_LCDDisplay0_PrintASCII('p'); FCD_LCDDisplay0_PrintASCII('l'); FCD_LCDDisplay0_PrintASCII('e'); FCD_LCDDisplay0_PrintASCII('t'); FCD_LCDDisplay0_PrintASCII('e'); //Delay //Delay: Timeout s delay_s(FCV_TIMEOUT); //Output //Output: 0x01 -> PORT B trisb = 0x00; portb = 0x01; //Call Component Macro //Call Component Macro: LCDDisplay(0)::ClearLine(1) FCD_LCDDisplay0_ClearLine(1);}void main(){ //Initialisation ansel = 0;anselh = 0; //Interrupt initialisation code option_reg = 0xC0; //Call Component Macro //Call Component Macro: LCDDisplay(0)::Start FCD_LCDDisplay0_Start(); //Delay //Delay: 25 ms delay_ms(25); //Call Component Macro //Call Component Macro: LCDDisplay(0)::Cursor(0, 0) FCD_LCDDisplay0_Cursor(0, 0); //Call Component Macro //Call Component Macro: LCDDisplay(0)::PrintASCII("System On") FCD_LCDDisplay0_PrintASCII('S'); FCD_LCDDisplay0_PrintASCII('y'); FCD_LCDDisplay0_PrintASCII('s'); FCD_LCDDisplay0_PrintASCII('t'); FCD_LCDDisplay0_PrintASCII('e'); FCD_LCDDisplay0_PrintASCII('m'); FCD_LCDDisplay0_PrintASCII(' '); FCD_LCDDisplay0_PrintASCII('O'); FCD_LCDDisplay0_PrintASCII('n'); //Call Component Macro //Call Component Macro: LCDDisplay(0)::Cursor(1, 1) FCD_LCDDisplay0_Cursor(1, 1); //Input //Input: A2 -> LowerSensor trisa = trisa | 0x04; FCV_LOWERSENSOR = ((porta & 0x04) == 0x04); //Decision //Decision: LowerSensor < 1? if (FCV_LOWERSENSOR < 1) { //Call Macro //Call Macro: Refill FCM_Refill(); } //Loop //Loop: While 1 while (1) { //Input //Input: A1 -> UpperSensor trisa = trisa | 0x02; FCV_UPPERSENSOR = ((porta & 0x02) == 0x02); //Decision //Decision: UpperSensor > 0? if (FCV_UPPERSENSOR > 0) { //Decision //Decision: Mode1>0? if (FCV_MODE1>0) { } else { //Call Component Macro //Call Component Macro: LCDDisplay(0)::ClearLine(1) FCD_LCDDisplay0_ClearLine(1); //Call Component Macro //Call Component Macro: LCDDisplay(0)::PrintASCII("Operational") FCD_LCDDisplay0_PrintASCII('O'); FCD_LCDDisplay0_PrintASCII('p'); FCD_LCDDisplay0_PrintASCII('e'); FCD_LCDDisplay0_PrintASCII('r'); FCD_LCDDisplay0_PrintASCII('a'); FCD_LCDDisplay0_PrintASCII('t'); FCD_LCDDisplay0_PrintASCII('i'); FCD_LCDDisplay0_PrintASCII('o'); FCD_LCDDisplay0_PrintASCII('n'); FCD_LCDDisplay0_PrintASCII('a'); FCD_LCDDisplay0_PrintASCII('l'); //Calculation //Calculation: // Mode1 = Mode1 + 1 FCV_MODE1 = FCV_MODE1 + 1; //Input //Input: A1 -> Outputs trisa = trisa | 0x02; FCV_OUTPUTS = ((porta & 0x02) == 0x02); //Decision //Decision: Outputs > 0? if (FCV_OUTPUTS > 0) { } } } else { //Loop //Loop: While LowerSensor > 0 while (1) { //Decision //Decision: Mode2 > 0? if (FCV_MODE2 > 0) { } else { //Calculation //Calculation: // Mode1 = Mode1 - 1 FCV_MODE1 = FCV_MODE1 - 1; //Call Component Macro //Call Component Macro: LCDDisplay(0)::ClearLine(1) FCD_LCDDisplay0_ClearLine(1); //Call Component Macro //Call Component Macro: LCDDisplay(0)::PrintASCII("Low Electrolyte") FCD_LCDDisplay0_PrintASCII('L'); FCD_LCDDisplay0_PrintASCII('o'); FCD_LCDDisplay0_PrintASCII('w'); FCD_LCDDisplay0_PrintASCII(' '); FCD_LCDDisplay0_PrintASCII('E'); FCD_LCDDisplay0_PrintASCII('l'); FCD_LCDDisplay0_PrintASCII('e'); FCD_LCDDisplay0_PrintASCII('c'); FCD_LCDDisplay0_PrintASCII('t'); FCD_LCDDisplay0_PrintASCII('r'); FCD_LCDDisplay0_PrintASCII('o'); FCD_LCDDisplay0_PrintASCII('l'); FCD_LCDDisplay0_PrintASCII('y'); FCD_LCDDisplay0_PrintASCII('t'); FCD_LCDDisplay0_PrintASCII('e'); //Calculation //Calculation: // Mode2 = Mode2 + 1 FCV_MODE2 = FCV_MODE2 + 1; } //Input //Input: A2 -> LowerSensor trisa = trisa | 0x04; FCV_LOWERSENSOR = ((porta & 0x04) == 0x04); if ((FCV_LOWERSENSOR > 0) == 0) break; } //Decision //Decision: LowerSensor < 1? if (FCV_LOWERSENSOR < 1) { //Call Macro //Call Macro: Refill FCM_Refill(); } } } mainendloop: goto mainendloop;}void interrupt(void){}