Dot Matrix, 8 x 8 , ATmega128 - 0224
Dot Matrix, 8 x 8 , ATmega128
[ 간략 설명 ]
◈ Dot Matrix, 8 x 8 , ATmega128
◈ 참조 : 도트 매트릭스 에디터
(비밀번호 필요) 호_ Dot Matrix Editor 3가지 .EXE
Dot Matrix, 8 x 8 , ATmega128
내용 넣기~~~~
◆◆ Dot Matrix (8x8) : 'A' 표시 ◆◆
코드 작성은 0223, 코드 완성은 0224.
/*
Dot Matrix
'A' 표시
0223E_DotMatrix_A.c
*/
#include <mega128.h>
#include <delay.h>
unsigned int Dot_A[8] = { 0x18, 0x3c, 0x24, 0x42, 0x7e, 0x42, 0x42, 0x42 };
unsigned int Dot_A_Comm[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
void main(void)
{
int i;
DDRA = 0xff;
DDRC = 0xff;
DDRB = 0xff;
while(1){
for( i = 0 ; i < 8 ; i++){
PORTA = Dot_A[i];
PORTB = Dot_A_Comm[i];
delay_ms(2);
}//endfor
}//endwhile
}//end main
◆◆ Dot Matrix (8x8) : 'I' '♥' 'U' 표시 ◆◆
/*
Dot Matrix
이름 표시 : I ♥ U
0223D_DotMatrix_name.c
*/
#include <mega128.h>
#include <delay.h>
#define COUNT 50
unsigned int Dot_Yi[3][8] = { { 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c}, // I
{ 0x66, 0xe7, 0xff, 0xff, 0xfe, 0x7e, 0x3c, 0x18 }, // ♥
{ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x3c} }; // U
unsigned int Dot_Yi_Comm[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20,0x40, 0x80};
void main(void)
{
int i, j , k ;
DDRA = 0xff;
DDRC = 0xff;
DDRB = 0xff;
while(1){
for( j = 0 ; j<3 ; j++){
for( k = 0 ; k < COUNT ; k++){
for( i = 0 ; i < 8 ; i++){
PORTA = Dot_Yi[j][i];
PORTB = Dot_Yi_Comm[i];
delay_ms(2);
}//endfor
i=0;
}//endfor
k=0;
}//endfor
j=0;
}//endwhile
}//end main
◆◆ Dot Matrix (8x8) : 이모티콘 표시 ◆◆
/*
Dot Matrix
이모티콘 : - _- , ^.^ , ^_^ , + _+
0224A_DotMatrix_emoticon.c
*/
#include <mega128.h>
#include <delay.h>
#define Count 50
unsigned int Emoticon[5][8] = {{0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x3c, 0x00},
{0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x3c, 0x00},
{0x00, 0x42, 0xa5, 0x00, 0x00, 0x42, 0x3c, 0x00},
{0x42, 0xe7, 0x42, 0x00, 0x00, 0x42, 0x3c, 0x00},
{0x00, 0xa5, 0x42, 0x00, 0x00, 0x3c, 0x42, 0x00}
};
unsigned int Emoticon_comm[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
void main(void)
{
int i, j, k;
DDRA = 0xff; // Dot Matrix LED RED
DDRC = 0xff; // Dot Matrix LED GREEN
DDRB = 0xff; // Dot Matrix LED Common
while(1){
for( j = 0 ; j < 5 ; j++){
for( k = 0; k < Count ; k++){
for( i = 0 ; i < 8 ; i++){
PORTA = Emoticon[j][i];
//PORTC = Emoticon[j][i];
PORTB = Emoticon_comm[i];
delay_ms(2);
}//endfori
i = 0;
}//endfork
k = 0;
}//endforj
j = 0;
}//endwhile
}//endmain
◆◆ Dot Matrix (8x8) : 스위치 연동 숫자표시 P.343 ◆◆
/*
Dot Matrix P.343
스위치와 Dot Matrix 연동
0224B_DotMatrix_p343.c
*/
#include <mega128.h>
#include <delay.h>
#define S 2
int Comm[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
int Dot[4][8] = {
{0x08, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1c}, // 1
{0x38, 0x44, 0x04, 0x04, 0x08, 0x10, 0x20, 0x7e}, // 2
{0x3c, 0x42, 0x02, 0x1c, 0x02, 0x02, 0x42, 0x3c}, // 3
{0x04, 0x0c, 0x14, 0x14, 0x24, 0x7e, 0x04, 0x04} // 4
};
void main(void)
{
int i, Key;
DDRA = 0xff;
DDRC = 0xff;
DDRB = 0xff;
DDRE = 0x00; // PE4-7 핀 입력 설정
while(1){
Key = PINE & 0xf0; // Port E read
switch(Key){
case 0b11100000: { // SW8 > '1' print
for( i = 0 ; i < 8 ; i++){
PORTB = Comm[i];
PORTA = Dot[0][i];
delay_ms(S);
PORTA = 0x00;
}//endfor
break;
}//endcase1
case 0b11010000: { // SW8 > '2' print
for( i = 0 ; i < 8 ; i++){
PORTB = Comm[i];
PORTA = Dot[1][i];
delay_ms(S);
PORTA = 0x00;
}//endfor
break;
}//endcase2
case 0b10110000: {
for( i = 0; i < 8 ; i++){
PORTB = Comm[i];
PORTA = Dot[2][i];
delay_ms(S);
PORTA = 0x00;
}//endfor
break;
}//endcase3
case 0b01110000: {
for( i = 0 ; i < 8 ; i++){
PORTB = Comm[i];
PORTA = Dot[3][i];
delay_ms(S);
PORTA = 0x00;
}//endfor
break;
}//endcase4
}//endswitch
}//endwhile
}//end main
'Edu > 유비쿼터스설비제어과정' 카테고리의 다른 글
Timer Couter, TC1, TIM1_COMPC, ATmega128, AVR - 0309 (0) | 2011.03.09 |
---|---|
Timer Count, TC 1.3, AVR, ATmega128 - 0308 (0) | 2011.03.08 |
Timer Count , ATmega128, AVR - 3034 (2) | 2011.03.04 |
Timer Count, AVR, ATmega128 - 0302 (0) | 2011.03.02 |
Dot Matrix, ATmega128, AVR - 0228 (0) | 2011.02.28 |
Dot Matrix, AVR, ATmega128 - 0223 (2) | 2011.02.23 |
전자사이크로회로, 미분회로, 4017 - 0222 (0) | 2011.02.22 |
미_ 채널전환회로, 디지털회로, RS래치 펄스 발생회로, 카운터회로, 디코더회로, 비안정 발진회로 및 스피커 구동회로 - 0221 (0) | 2011.02.21 |
ATmega128 : Stepping Motor, 정회전, 역회전 - 0218 (0) | 2011.02.18 |
ATmega128, AVR, Stepping Motor, 모터, 정회전, 역회전 - 0217 (0) | 2011.02.18 |