Professional Documents
Culture Documents
A
A
A
row_select[8]={0b00000001,0b00000010,0b00000100,0b00001000,0b00010000,0b00100000,0b
01000000,0b10000000};
char COL[8]={~0x3e,~0x7e,~0xc8,~0xc8,~0x7e,~0x3e,~0x00,~0x00};
char i ;
void main ()
{
DDRB=255;
DDRC=255;
while(1)
{
for(i=0 ; i<8 ; I++)
{
PORTB=row_select[i]; //select row as array element
PORTC=COL[i];//send data to port C as array element
// short delay
}
}
}
====================================================================
A
=====================================================================
#include <avr/io.h> //IO header
//#define F_CPU 11059200UL //defining crystal frequency
#include <util/delay.h> //delay header
int main(void)
{
DDRD = 0xFF; //PORTD as output
DDRA = 0xFF; //PORTA as output
DDRC = 0xFF; //PORTC as output
char ALPHA[]={
0,0b11000011,0b11000011,0b11000011,0b11000011,0b11100111,0b01111110,0b00111100,0,0,
0b11000011,0b11000011,0b11000011,0b11111111,0b11111111,0b11000011,0b11000011,0b1100
0011,0,0,
0b01111001,0b11111011,0b11011111,0b11011110,0b11011100,0b11011000,0b11111111,0b1111
1111 ,0,0,
0,0b11000011,0b11000011,0b11000011,0b11000011,0b11100111,0b01111110,0b00111100,0,0,
0b11111110,0b11111111,0b00000011,0b00000011,0b00000011,0b00000011,0b11111111,0b1111
1110,0,0,
0b11000011,0b11000011,0b11000011,0b11111111,0b11111111,0b11000011,0b11000011,0b1100
0011,0,0,
0b11000000,0b11000000,0b11000000,0b11111111,0b11111111,0b11000000,0b11000000,0b1100
0000,0,0,
0,0b01111110,0b10111101,0b11000011,0b11000011,0b11000011,0b11111111,0b11111111,0,0,
0b11000011,0b11000011,0b11000011,0b11111111,0b11111111,0b11000011,0b11000011,0b1100
0011,0,0,
0b00011111,0b11011111,0b11011000,0b11011011,0b11011011,0b11011011,0b11111111,0b1111
1111,0,0,
0,0b11011011,0b11011011,0b11011011,0b11011011,0b11011011,0b11111111,0b11111111,0,0,
0b11001110,0b11011111,0b11011011,0b11011011,0b11011011,0b11011011,0b11111011,0b0111
0011,0,0,
0b11000000,0b11000000,0b11000000,0b11111111,0b11111111,0b11000000,0b11000000,0b1100
0000,0,0,
0,0,0,0,0,0,0,0,0,0,0,
};
while(1)
{
for (int i=0;i<8;i++)
{
PORTC =PORT[i]; //ground the PORTC pin
PORTA = ~characters[x][i]; //power the PORTA
}
// there are 142 values in the set of ALPHA to display 'CIRCUIT DIGEST',
then shift them after each loop execution
for( x=0;x<80;x++)
{
}
}
}