seven segment fixed display using AVR

Seven segment Displays are very common when it comes to display digits, these are widely used in clocks, stop watches and event counter etc. A Simple seven segment display.A seven segment display is an electronic display device that can display digits from 0-9.Every LED is assigned a name from 'a' to 'h' and is identified by its name. Seven LEDs 'a' to 'g' are used to display the numerals while eighth LED 'h' is used to display the dot/decimal.
  

Proteus design

we are working  on more than one common cathode segment you need to latch data suitably otherwise data would be misinterpreted .that is why you should enable only one seven segment display at a time. PORTD is connected to seven segment and PC0 and PC1 is used to turn the transistor on or off. transistor can acts as switch. using this property of transistor we enable single 7-seg at a particular time while retrieving data from controller.after receiving data(character 'H') at unit place turn it off .our next step is to turn on second transistor to latch data(character 'R') to be displayed at tens place.

complete code1

#include<avr/io.h>
#include<util/delay.h>
#define segment PORTD
#define tansitor PORTC
#define unitcnt PC0
#define tenscnt PC1
unsigned char unit,tens;
void display();

void main()
{
DDRD=0xff;
DDRC=0x03;
 unit=0Xf7;    //    character H
 tens=0X76; //  character R
 while(1)
{
  display();
}
}
void display()
{
segment=unit; // transistor1
tansitor=(1<<unitcnt)|(0<<tenscnt);
_delay_ms(1);
tansitor=(0<<unitcnt)|(0<<tenscnt);
segment=tens;    //    transistor2
tansitor=(0<<unitcnt)|(1<<tenscnt);
_delay_ms(1);
tansitor=(0<<unitcnt)|(0<<tenscnt);
}

complete code2

#include<avr/io.h>
#include<util/delay.h>
#define segment PORTD
unsigned char unit,tens;
void display();

void main()
{
DDRD=0xff;
DDRC=0x03;
unit=0Xf7;        
tens=0X76;
while(1)
{
display();
}
}
void display()
{
segment=unit;                 // transistor1
PORTC=PORTC|0b00000001;
_delay_ms(1);
PORTC=PORTC&0b11111110; 
segment=tens;                  //  transistor2
PORTC=PORTC|0b00000010;
_delay_ms(1);
PORTC=PORTC&0b11111101;
}

VIDEO

Category: 

Share

Who's new

  • ravirajpatil871...
  • shubhambajoria
  • yassir
  • demiholyman890954
  • scottgillum51169040

Get Notified

 

Share

We are Social

Syndicate

Subscribe to Syndicate