Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me with improving a 7 segment display code for AVR microcontroller

Status
Not open for further replies.

jsureshp

Junior Member level 3
Joined
Jul 20, 2010
Messages
26
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Chennai
Activity points
1,492
Actually i write a program for 7 segment display.
This coding working but in simulator not showing perfectly.
That means
not showing all at the same time.
one by one only showing.
I know my code was like that only written.
ok
I give my 7 segment coding....


anybody help to me for the right code.


#include<avr/io.h>

unsigned char i,c1=0,c2=0,c3=0;
unsigned char data[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};

void display();
void delay();

int main()
{

DDRD=0xFF;
DDRC=0x0F;

while(1)
{
for(i=0;i<=10;i++)
{
if(i==10)
{
i=0;
c1++;
}

if(c1==10)
{
c1=0;
c2++;
}

if(c2==10)
{
c2=0;
c3++;
}

if(c3==10)
{
c3=0;
}

display();
}
}

}

void display()
{
PORTD=data;
PORTC=0x01;
PORTD=data;
delay();

PORTC=0x02;
PORTD=data[c1];
delay();

PORTC=0x04;
PORTD=data[c2];
delay();

PORTC=0x08;
PORTD=data[c3];
delay();
}

void delay()
{
unsigned char j;
for(j=0;j<5;j++);
}





Please Edit this code and give me a right code
This code for AVR Microcontroller
 

Re: 7 segment Display

Well I haven't checked your code, but if you say it works fine except flicker part, this is because of most simulators don't support POV Persistence of vision - Wikipedia, the free encyclopedia effect, as a result you should see a break between your segments displaying number.
i think you should move this thread to microcontroller section.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top