Microcontroller › AVR › 5X7 dot matrix led interfacing › code to display
February 7, 2011 at 1:39 pm
#5449
dagakshay
Participant
code to display ‘A’:
#include<avr/io.h>
#include<util/delay.h>
int main (void)
{
DDRB=0xff; // set port B as o/p
DDRD=0xff; // set port D as i/p
while(1)
{
PORTB=~(0x01);
PORTD=0x04; // to display first row
_delay_ms(1);
PORTB=~(0x02);
PORTD=0x0A; // to display second row
_delay_ms(1);
PORTB=~(0x04);
PORTD=0x11; // to display third row
_delay_ms(1);
PORTB=~(0x08);
PORTD=0x1F; // to display fourth row
_delay_ms(1);
PORTB=~(0x10);
PORTD=0x11; // to display fifth row
_delay_ms(1);
PORTB=~(0x20);
PORTD=0x11; // to display sixth row
_delay_ms(1);
PORTB=~(0x40);
PORTD=0x11; // to display seventh row
_delay_ms(1);
}
}