﻿ Simple dynamic LED display drive_Circuit Diagram World ﻿
Position: Index > Simple Circuit >

# Simple dynamic LED display drive

2015-01-09 18:49
Declaration:We aim to transmit more information by carrying articles . We will delete it soon, if we are involved in the problems of article content ,copyright or other problems.

I have got a simple 4 digit LED display routine. This is simulated using Proteus simulator. So in the picture you see simplified version of circuit. In real world you might need to strobe digits using transistor keys. Control program is written using WinAVR tool chain.

Bellow is a complete C file

```//----------------------------------------------------

#include

#include

#include

#include

#include

#include

uint8_t numbers[]={

0b11000000,//0

0b11111001,//1

0b10100100,//2

0b10110000,//3

0b10011001,//4

0b10010010,//5

0b10000010,//6

0b11111000,//7

0b10000000,//8

0b10010000,//9

0b01111111//.

};

uint8_t i;

void initAmega8()

{

PORTD=0xFF; //Port D all to "1" - LEDS OFF

DDRD=0xFF; //Port D all to output

//Port B control lines to "1" - Transistors OFF

PORTB &=~((1<<<<

//Port B control lines as output

DDRB |=((1<<<<

}

void sendNumber(uint8_t digit, uint8_t position)

{

//0...9 for digit; 1..4 for position

PORTD=numbers[digit];

PORTB|=_BV(position-1);

_delay_us(100);

PORTB&=~_BV(position-1);

_delay_us(100);

}

int main(void)

{

initAmega8();

while(1)

{

sendNumber(2,1);//LCD display shows "2006"

sendNumber(0,2);

sendNumber(0,3);

sendNumber(6,4);

}

return 0;

}

//----------------------------------------------------```