We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hi. i got a problem in compiling this program.can anyone help me???i tried so many times..but still got error..can anyone help me what is wrong and what to be change.tq.here,is the program:
#include<reg51.h> #include <intrins.h> #include"lcdbusy.h"
#define tensec 150 void ext_init(void); void timerinterrupt_init(); // calling the timer and exter interrupt init functions void timer0_init();
void delay(unsigned int ); void start_poring(void); //////////////////*****************************************************//////////// sbit sw1=P2^0; // assign the p2.0 for switch0 sbit sw2=P2^1; // assign the p2.1 for switch1
sbit MOT_FWD=P0^0; sbit MOT_REV=P0^1;
/////////////////////*****************************************************//////// bit counterflag=0;
volatile bit solaniodflag=0,timer_flag=0; unsigned char val=0,location=0; volatile unsigned int count_ON=0; /*******************************************************************************************/ void main() { timer0_init(); ext_init(); lcd_init(); message(0x80,"INJUCTION PUMP"); message(0xc0,"sw1 10ml, sw2 15ml"); delay(50); while(1) { if(sw1==0) { for(val=0;val<5;val++) { MOT_FWD=0; delay(2); MOT_REV=1; } }
if(sw2==0) { for(val=0;val<10;val++) { MOT_FWD=0; delay(2); MOT_REV=1; } break; } if(solaniodflag==1) { ET0=1; // enable the timer interrupt flag bit in the IE register TR0=1; //Start the Timer solaniodflag=0; // clearing the interrupt flag bit timer_flag=1; start_poring(); } if(timer_flag==1) { while(1) { start_poring(); if(count_ON>=tensec) { TR0=0; //Timer OFF ET0=0; // Disable the timer interrupt timer_flag=0; count_ON=0; P0=0x00; break; } } } } }
void timer0_init(void) { TL0=0XFD; TH0=0X4B; // timer registewr value for 50 msec }
void timer0(void) interrupt 1 { TR0=0; TL0=0XFD; TH0=0X4B; TR0=1; count_ON++;
} /***************external interrupt intializing function*********************************/ void ext_init() { EA=1; EX1=1; IT1=1; } void ext1(void) interrupt 2 {
solaniodflag=1; }
void start_poring(void) { val=0; MOT_REV=0; while(1) { MOT_FWD=1; delay(4); MOT_REV=0; delay(20); val++; if(val==150) break; } }