Displaying Numbers in 7segmen by Using Code Vision AVR.
This post I will give a tutorial to show 7segment ATMega 16 based microcontrollers using software CodeVision AVR compiler.
First we create a simulation in proteus, as shown below :
7segmen used are common cathode connected to the ports C0-C7. Setting code vision equal to the previous post.
type the following syntax:
while (1)
{
PORTC=0b00000110;
}
}
then after the simulated number 1 will appear.
Here's a table to display numbers using binary code:
PC.7
|
PC.6
|
PC.5
|
PC.4
|
PC.3
|
PC.2
|
PC.1
|
PC.0
|
Display
|
dp
|
g
|
f
|
e
|
d
|
c
|
b
|
a
|
|
0
|
0
|
1
|
1
|
1
|
1
|
1
|
1
|
0
|
0
|
0
|
0
|
0
|
0
|
1
|
1
|
0
|
1
|
0
|
1
|
0
|
1
|
1
|
0
|
1
|
1
|
2
|
0
|
1
|
0
|
0
|
1
|
1
|
1
|
1
|
3
|
0
|
1
|
1
|
0
|
0
|
1
|
1
|
0
|
4
|
0
|
1
|
1
|
0
|
1
|
1
|
0
|
1
|
5
|
0
|
1
|
1
|
1
|
1
|
0
|
0
|
1
|
6
|
0
|
0
|
0
|
0
|
0
|
1
|
1
|
1
|
7
|
0
|
1
|
1
|
1
|
1
|
1
|
1
|
1
|
8
|
0
|
1
|
1
|
0
|
1
|
1
|
1
|
1
|
9
|
To display the numbers 0-9, then type the following syntax:
while (1)
{
PORTC=0x3f;
delay_ms(100);
PORTC=0x06;
delay_ms(100);
PORTC=0x5b;
delay_ms(100);
PORTC=0x4f;
delay_ms(100);
PORTC=0x66;
delay_ms(100);
PORTC=0x6d;
delay_ms(100);
PORTC=0x7d;
delay_ms(100);
PORTC=0x07;
delay_ms(100);
PORTC=0x7f;
delay_ms(100);
PORTC=0x6f;
delay_ms(100);
}
}