질문게시판 > LED 잔상 텍스터 플레이

인기검색어 > 아두이노 센서 ATMEGA128

최신글 질문게시판 동영상강좌 가입하기

▼ BASIC4MCU 후원업체 신제품 정보 ▼

▲ BASIC4MCU 후원업체 신제품 정보 ▲

BASIC4MCU > 질문게시판

LED 잔상 텍스터 플레이

페이지 정보

작성자 박희범 작성일18-06-11 15:05 조회7,570회 댓글2건

본문

#include <mega128.h> 
#include <delay.h>
#include <stdio.h>
//
#define U16 unsigned int
#define U08 unsigned char
//
char hannam[72]={
  0x00,0xF7,0xF7,0xF7,0xF7,0xF7,0xF7,0xF7,0xF7,0x00,0xFF,0xFF,0x07,0xF3,0xF4,0xF6,0xF6,0xF6,0xF6,0xF4,0xF3,0x07,0xFF,0xFF,
  0x00,0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,0x00,0xFF,0xFF,0x00,0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,0x00,0xFF,0xFF,
  0x07,0xF3,0xF4,0xF6,0xF6,0xF6,0xF6,0xF4,0xF3,0x07,0xFF,0xFF,0x00,0xFE,0xFd,0xFB,0xF7,0xF7,0xFB,0xFD,0xFE,0x00,0xFF,0xFF
};
char elec[130]={
  0x00,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0xFF,0xFF,0xFF,0x00,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0xFF,0xFF,0xFF,
  0x00,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0x76,0xFF,0xFF,0xFF,0x81,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0xBD,0xFF,0xFF,0xFF,
  0xFE,0xFE,0xFE,0xFE,0x00,0xFE,0xFE,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0x00,0xF6,0xF6,0xF6,0xF6,0xF6,0xF6,0xF6,0xF6,0x09,0xFF,0xFF,0xFF,
  0x81,0x7E,0x7E,0x7E,0x7E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,0xFF,0xFF},
  {0xFF,0xFF,0x00,0xF6,0xF6,0xF6,0xF6,0xF9,0xFF,0xFF},
  {0xFF,0xFF,0xC1,0xBE,0xBE,0xAE,0x9E,0x41,0xFF,0xFF},
  {0xFF,0xFF,0x00,0xF6,0xF6,0xF6,0xF6,0x09,0xFF,0xFF},
  {0xFF,0xFF,0xB9,0x76,0x76,0x76,0x76,0x8D,0xFF,0xFF},
  {0xFF,0xFF,0xFE,0xFE,0x00,0xFE,0xFE,0xFF,0xFF,0xFF},
  {0xFF,0xFF,0x80,0x7F,0x7F,0x7F,0x7F,0x80,0xFF,0xFF},
  {0xFF,0xFF,0xF8,0xC7,0x3F,0x3F,0xC7,0xF8,0xFF,0xFF},
  {0xFF,0xFF,0x00,0xBF,0xCF,0xCF,0xBF,0x00,0xFF,0xFF},
  {0xFF,0xFF,0x3E,0xCD,0xF3,0xF3,0xCD,0x3E,0xFF,0xFF},
  {0xFF,0xFF,0xFC,0xF3,0x0F,0xF3,0xFC,0xFF,0xFF,0xFF}, //Y
  {0xFF,0xFF,0x3E,0x5E,0x6E,0x76,0x7A,0x7C,0xFF,0xFF}  //Z
};
//
U08 uniPhase[]={0x81,0x85,0x84,0x86,0x82,0x8A,0x88,0x89};
//
U08 num=10;
//
void LDelay(U16 Dly,float f){ U16 i; float dd; for(i=0; i<Dly; i++)for(dd=0.;dd<f;dd+=0.2); }
//
void led_hannam(){ static int i=0,c=0; if(PIND==0xFF)c=1; else PORTA=PORTB=0xFF; if(c){ PORTA=PORTB=hannam[i]; if(++i== 71)i=c=0; } LDelay(1,10.8); } // HANNAM문자 함수
void led_elec()  { static int i=0,c=0; if(PIND==0xFF)c=1; else PORTA=PORTB=0xFF; if(c){ PORTA=PORTB=elec[i];   if(++i==129)i=c=0; } LDelay(1, 7.8); } // ELECTRONIC문자 함수
void led_jwl()   { static int i=0,c=0; if(PIND==0xFF)c=1; else PORTA=PORTB=0xFF; if(c){ PORTA=PORTB=jwl[i];    if(++i== 47)i=c=0; } LDelay(1,20.6); } // jwl문자 함수
void led_ksl()   { static int i=0,c=0; if(PIND==0xFF)c=1; else PORTA=PORTB=0xFF; if(c){ PORTA=PORTB=ksl[i];    if(++i== 47)i=c=0; } LDelay(1,20.6); } // ksl문자 함수
//
void led(U08 n)  { static int i=0,c=0; if(PIND==0xFF)c=1; else PORTA=PORTB=0xFF; if(c){ PORTA=PORTB=font1[n][i]; if(++i==9)i=c=0; } LDelay(1,20.6); }
//
void LED_USART(){
  U08 c;
  if((UCSR0A&0x80)==0x80){
    c=UDR0;
    if     ((c>='0')&&(c<='9'))num=c&0x0F;
    else if((c>='A')&&(c<='Z'))num=c-'A'+11;
    else if(c=='-')num=10;
    else if(c=='=')num=37;
    else if(c==';')num=38;
    else if(c==',')num=39;
  }
}
//
void count(){
  if     (num<= 9)led(num);
  else if(num==10)led_hannam();
  else if(num<=36)led(num);
  else if(num==37)led_elec();
  else if(num==38)led_jwl();
  else if(num==39)led_ksl();
}
//
void SDelay(U16 Dly){ while(Dly--); }
//
void uni_HA_MtrMove(U08 Direction){
  static int Phase=0; U08 TroquePhase;
  TroquePhase=uniPhase[Phase];
  if(Direction){ PORTB=TroquePhase; if(++Phase>8)Phase=0; }
  TroquePhase&=0xFF;
  SDelay(800);
}
//
void main(){
  PORTA=0xFF; DDRA=0xFF;
  PORTB=0xFF; DDRB=0xFF;
  PORTD=0xFE; DDRD=0xFE;
  UBRR0L=8; UCSR0B=0x18;
  while(1){
    LED_USART(); count();
    uni_HA_MtrMove(1);
  }
}

저희가 hannam 이아닌

KANGWON 이나 숫자 1 , 2, 3,4,5,6,7,8,9 모양을 남기고싶은데 어떻게 해야할까요..?
  • BASIC4MCU 작성글 SNS에 공유하기
  • 페이스북으로 보내기
  • 트위터로 보내기
  • 구글플러스로 보내기
  • 카카오톡으로 보내기

댓글 : 2

조회수 : 7,570

master님의 댓글

master 작성일

char hannam[72]={
  0x00,0xF7,0xF7,0xF7,0xF7,0xF7,0xF7,0xF7,0xF7,0x00,0xFF,0xFF,0x07,0xF3,0xF4,0xF6,0xF6,0xF6,0xF6,0xF4,0xF3,0x07,0xFF,0xFF,
  0x00,0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,0x00,0xFF,0xFF,0x00,0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F,0x00,0xFF,0xFF,
  0x07,0xF3,0xF4,0xF6,0xF6,0xF6,0xF6,0xF4,0xF3,0x07,0xFF,0xFF,0x00,0xFE,0xFd,0xFB,0xF7,0xF7,0xFB,0xFD,0xFE,0x00,0xFF,0xFF
};
폰트를 2진수로 배열하면 무슨 글자인지 알아볼 수 있습니다.
알파벳이나 숫자는 char font1[][10] 에 있으니 사용법만 공부하면 되겠죠?

박희범님의 댓글

박희범 댓글의 댓글작성일

폰트를 2진수르 배열한다는 말이 잘 이해가안가요 ㅜㅜ..

게시물 검색

BASIC4MCU > 질문게시판 목록

제목 날짜
공지 MCU, AVR, 아두이노 등 전자공학에 관련된 질문은… 스태프  19-01-15
공지 사이트 이용 안내 댓글[25] master  17-10-29
질문 앱인벤터 list index too large 오류 질… 첨부파일PT규 새글 22-07-07
질문 Atmega IO핀 출력 상태 질문이요.. 댓글[3] chelsea 새글 22-07-06
답변 답변 : Atmega IO핀 출력 상태 질문이요.. 댓글[6] master 새글 22-07-06
질문 아두이노 센서 쉴드 v5.0 과 음성인식 모듈(V2)통… 댓글[6] 첨부파일AutoSun  22-07-05
질문 초음파 센서를 사용한 dc모터 제어에 관해 질문 있습니… 첨부파일뉴비에오  22-07-04
답변 답변 : 초음파 센서를 사용한 dc모터 제어에 관해 질… 댓글[2] master  22-07-05
질문 아두이노 Sensor Shield 5.0 시리얼 통신 … 댓글[2] AutoSun  22-07-04
질문 Atmega 코드 좀 봐주세요. 댓글[1] 첨부파일chelsea  22-07-04
질문 아두이노 while문 탈출 질문 yhj2644  22-07-01
답변 답변 : 아두이노 while문 탈출 질문 댓글[8] master  22-07-01
질문 ESP32-C3 리튬폴리머 ADC 전압 체크 관련 문의… 댓글[3] cansad  22-06-30
질문 ESP32-C3 리튬폴리머 ADC 전압 체크 관련 문의 댓글[3] cansad  22-06-30
질문 빵판없이 디스플레이 넣을 수 있을까요? 댓글[2] 첨부파일오소로롯  22-06-29
질문 라즈베리파이4 신형 선택문제 댓글[1] maximum  22-06-26
질문 음전압 ADC 댓글[2] 412904  22-06-26
질문 아두이노 센서값 출력 질문입니다! 댓글[1] 아궁2  22-06-24
질문 ATmega128, ATmega28 RS232통신 첨부파일Moon4201  22-06-24
답변 답변 : ATmega128, ATmega28 RS232… 댓글[1] master  22-06-25
질문 서보모터, 온습도센서 코드 질문 댓글[2] 첨부파일kshdlfaldfh  22-06-22
답변 답변 : 서보모터, 온습도센서 코드 질문 댓글[15] master  22-06-22
질문 steppermulti5 질문 응애  22-06-21
답변 답변 : steppermulti5 질문 댓글[1] master  22-06-22
질문 atmega128 avr usart 질문 snoflak  22-06-21
답변 답변 : atmega128 avr usart 질문 댓글[5] master  22-06-21
질문 사용자 정의 함수 변환 하는 방법 댓글[2] 첨부파일da0800  22-06-21
질문 atmega128 댓글[1] 양의노래  22-06-20
질문 아두이노 동시동작 재질문 댓글[9] 첨부파일죠르디  22-06-20
질문 초음파센서로 dc모터 제어하기 댓글[1] 첨부파일난쟁2  22-06-20
게시물 검색


Privacy Policy
MCU BASIC ⓒ 2017
PC버전