I'm doing a project using PIC16F877.Smocking room air refresher where if the pic detect smoke from the smoke sensor (input) it will activate the fan (1st output) for 10 second and than activate the 2nd one after the fan which is perfume (2nd Output) to spray. can any one help me check the program i make are correct or not...Thank you so much...
#include<pic.h> //include PIC microcontroller library
//configuration//
__CONFIG(0x2FF4); //PIC microcontroller configuration
__CONFIG(0x3FFF); //PIC microcontroller configuration
//define declaration//
#define fan_ra RB7
#define perfume_rb RB6
#define sensor RA0
void main()
{
unsigned char m=0,i=0;
ANSEL=0;
ANSELH=0;
//TRIS Configuration (input & output)//
TRISA=0b11111111; //configure PORT A I/O direction
TRISB=0b00000000; //configure PORT B I/O direction
PORTA=0xb11111111; //configure PORT A I/O direction
PORTB=0xb00000000; //configure PORT B I/O direction
while(1)
{
if(sensor == 1)
{
fan_ra = 1;
delay(10000);
fan_ra = 0;
perfume_rb = 1;
delay( 5000 );
perfume_rb = 0;
}
do { } while(sensor == 1);
}
}
#include<pic.h> //include PIC microcontroller library
//configuration//
__CONFIG(0x2FF4); //PIC microcontroller configuration
__CONFIG(0x3FFF); //PIC microcontroller configuration
//define declaration//
#define fan_ra RB7
#define perfume_rb RB6
#define sensor RA0
void main()
{
unsigned char m=0,i=0;
ANSEL=0;
ANSELH=0;
//TRIS Configuration (input & output)//
TRISA=0b11111111; //configure PORT A I/O direction
TRISB=0b00000000; //configure PORT B I/O direction
PORTA=0xb11111111; //configure PORT A I/O direction
PORTB=0xb00000000; //configure PORT B I/O direction
while(1)
{
if(sensor == 1)
{
fan_ra = 1;
delay(10000);
fan_ra = 0;
perfume_rb = 1;
delay( 5000 );
perfume_rb = 0;
}
do { } while(sensor == 1);
}
}