void main() { lcd_ini(); lcd_dataa("%Rel.Humidity:"); while(1) { adc(); } }
//main function void main(){ counter=0; amount=90; fuel_counter=0; fuel=0; passenger_out=0; while(1){ if(pushbutton==0){ if(dip1==0){ ledred=1; ledgreen=0; passenger_out=0; } else { ledred=0; ledgreen=1; amount=90; } stepper = 0x08;//1000****A delay(); stepper = 0x0C;//1100****A,B delay(); stepper = 0x04;//0100****B delay(); stepper = 0x06;//0110****B,C delay(); stepper = 0x02;//0010****C delay(); stepper = 0x03;//0011****C,D delay(); stepper = 0x01;//0001****D delay(); stepper = 0x09;//1001****A,D fuel_counter++; if(ledred==1){ counter++; seconds=0x00; minutes=0x00; hours=0x00; if(counter==5){ amount+=20; //****start of the lcd interfacing*******// lcd_cmd(0x38); // Configuring settings to 8-bit 2 row lcd_cmd(0x0E); lcd_cmd(0x0C); //Display on lcd_cmd(0x80); lcd_dataa("Amount:");//end of first amount lcd_cmd(0x88); //Set cursor to blink at line 8 positon 1 delay_lcd(250); lcd_data(amount); //**********************end of lcd interfacing***************************// counter=0; } delay(); } } else{ ledred=0; ledgreen=0; lcd_cmd(0x01); //reset the lcd amount=90; fuel=0; passenger_out=0; seconds=0; minutes=0; hours=0; } if(ledgreen==1){ //keeping track of the time when there is no passenger****** passenger_out+=1; if(passenger_out%2==0){ seconds+=1; if(seconds==60){ minutes+=1; delay(); seconds=0x00; if(minutes==60){ hours+=1; delay(); minutes=0x00; if(hours==24){ hours=0x00; } } } } lcd_cmd(0x38); // Configuring settings to 8-bit 2 row lcd_cmd(0x0E); lcd_cmd(0x0C); //Display on lcd_cmd(0x90); lcd_dataa("Empty:");//end of first amount lcd_cmd(0x96); //Set cursor to blink at line 1 positon 2 delay_lcd(250); lcd_data(hours); lcd_cmd(0x98); lcd_dataa(":");//end of first amount delay_lcd(250); lcd_cmd(0x99); delay_lcd(250); lcd_data(minutes); lcd_cmd(0x9B); lcd_dataa(":");//end of first amount lcd_cmd(0x9C); //Set cursor to blink at line 1 positon 2 delay_lcd(250); lcd_data(seconds); }//end of keeping track of the time when there is no passenger if(fuel_counter==10){//start of the fuel consumption count fuel+=2000; lcd_cmd(0x38); // Configuring settings to 8-bit 2 row lcd_cmd(0x0E); lcd_cmd(0x0C); //Display on lcd_cmd(0xC0); lcd_dataa("Fuel:");//end of first amount lcd_cmd(0xC8); //Set cursor to blink at line 1 positon 3 delay_lcd(250); lcd_data(fuel); fuel_counter=0; } } }