SEVEN SEGMENT display using ARDUINO
STEP1-
After three steps we will learn to write the word ON SEVEN SEGMENT (common cathod).
1. fist we configure the seven segment common cathode display. The common cathode display is have 10 pins . Five upper side and five lower side . The middle pin of upper side pin is the ground pin and similarly the lower side the middle pin is ground pin . the ground pins are common pin . we doesn't need to connect upper pin to ground separately. fist we connect the ground pin to ground and the we connect 3.3v pin of the micro controller and variable resistance. the output pin of the variable resistance is our test pin . we will connect this pin to the seven segment pin and test .
as shown in fig.
the connection of pin are described below.
STEP2-
led pins arduino pins
a- D2
b - D3
c - D4
d - D5
e - D6
f - D7
g - D8
h - D9
MIDDLE PIN- GROUND PIN
AFTER SETUP CIRCUIT WE will burn the arduino nano. the software is given below.
STEP3-
void setup() {
DDRD=0XFFF;//for portD as output//
DDRB=0XFF;//for portB as output//
}
void loop() {
delay(100);
PORTD=0XFF;// command for write zero on led//
PORTB=0X00;
delay(1000);
PORTD=0X18;// command for write 1 on led//
PORTB=0X00;
delay(1000);
PORTD=0X6C;// command for write 2 on led//
PORTB=0X01;
delay(1000);
PORTD=0X3C;// command for write 3 on led//
PORTB=0X01;
delay(1000);
PORTD=0X98;// command for write 4 on led//
PORTB=0X01;
delay(1000);
PORTD=0XB4;// command for write 5 on led//
PORTB=0X01;
delay(1000);
PORTD=0XF4;// command for write 6 on led//
PORTB=0X01;
delay(1000);
PORTD=0X1c;// command for write 7 on led//
PORTB=0X00;
delay(1000);
PORTD=0XFF;// command for write 8 on led//
PORTB=0X01;
delay(1000);
PORTD=0XBC;// command for write 9 on led//
PORTB=0X01;
delay(1000);
}
DDRD=0XFFF;//for portD as output//
DDRB=0XFF;//for portB as output//
}
void loop() {
delay(100);
PORTD=0XFF;// command for write zero on led//
PORTB=0X00;
delay(1000);
PORTD=0X18;// command for write 1 on led//
PORTB=0X00;
delay(1000);
PORTD=0X6C;// command for write 2 on led//
PORTB=0X01;
delay(1000);
PORTD=0X3C;// command for write 3 on led//
PORTB=0X01;
delay(1000);
PORTD=0X98;// command for write 4 on led//
PORTB=0X01;
delay(1000);
PORTD=0XB4;// command for write 5 on led//
PORTB=0X01;
delay(1000);
PORTD=0XF4;// command for write 6 on led//
PORTB=0X01;
delay(1000);
PORTD=0X1c;// command for write 7 on led//
PORTB=0X00;
delay(1000);
PORTD=0XFF;// command for write 8 on led//
PORTB=0X01;
delay(1000);
PORTD=0XBC;// command for write 9 on led//
PORTB=0X01;
delay(1000);
}
Comments
Post a Comment