Академический Документы
Профессиональный Документы
Культура Документы
There
were several reasons to choose this microcontroller for out product.
1. PIC 16F877A microcontroller can be easily found from the local market.
2. Ease of programming using high level language.
3. Low cost microcontroller.
4. Ease of mounting due to the available dual inline package.
In our project both PORTA PORTB PORTC and PORTD are used to input output
purposes. PORTB is used to give the inputs to the microcontroller and the other three
Ports are used to take the output signals to lightup the LED s according to the
required pattern. Nine push button switches are connected to the PORT B and
PORTC to take the inputs from the user. And also PORTA is used to control the
biasing of a set of transistors for better sitching purpose. PORTC and PORTD are
directily connected to a LED metrix to light up required LEDs according to the input
signal given by the user..
Programming aspects
start This is the main control algorithm that we have use in our design.
Program takes input signals from the user and call relevant functions
to light up the correct paths in the display system
Initialize
the PIC
Read PORTB
NO
Is RB0=0?
YES NO
Is RB1=0?
Call
Badminto NO
n() YES Is RB2=0?
Call
Carrom() YES NO
Is RB3=0?
Call
Tennis()
YES NO
Is RB4=0?
Call
Tab_Ten
nis() YES
NO
Is RB5=0?
Call
ground()
YES NO
Is RB6=0?
Call
vollyball( NO
) YES
Is RB7=0?
Call
Baskt_bal
l() YES NO
Is RC0=0?
Call Call
gym() Net_ball(
YES )
MikroC programming language is used for the programming purpose of this
microcontroller. We could use simple C program codes to implement our program
task as a result of using this IDE.
int i;
void initialize(){
TRISA=0; // Port A outputs for transisors
PORTA=0;
TRISD=0;
PORTD=0;
void badminton(){
PORTA= 0b00000001;
for(i=0; i<5;++i){
PORTC=0b00000001;
delay_us(500);
PORTC=0b00000010;
delay_us(500);
PORTC=0b00000100;
delay_us(500);
PORTC=0b00001000;
delay_us(500);
PORTC=0b00010000;
delay_us(500);
}
PORTC=0b00000000;
void carrom(){
void netball(){
void basketball(){
void vollyball(){
void tennis(){
void tab_tannis(){
void play_ground(){
void gym(){
}
void main(){
carrom();
netball() ;
tennis();
}
}
}
When the PIC MPU got powered, it is entered to a infinite loop which reads the
PORTB values. The values of PORTB remain in 0 values until a button is pressed. As
soon as a button is pressed, a high voltage (+5V) is generated at the relevant pin .so
that the MPU can identify which button is pressed by the user. Then it calls a
relevant function according to the pressed button. There are nine functions named as
badminton, tennis, tab_tannis, playground, netball, volleyball, basketball. Each
represents a path to each sport. All the codes need to light up the required path are
written inside those functions.