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

TODAY1,390 TOTAL3,324,499
사이트 이용안내
Login▼/회원가입
최신글보기 질문게시판 기술자료 동영상강좌

아두이노 센서 ATMEGA128 PWM LED 초음파 AVR 블루투스 LCD UART 모터 적외선


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

페이지 정보

작성자 박희범 작성일2018-06-11 15:05 조회15,196회 댓글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,0x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x7E,0x7E,0x81,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

조회수 15,196

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진수르 배열한다는 말이 잘 이해가안가요 ㅜㅜ..

질문게시판HOME > 질문게시판 목록

MCU, AVR, 아두이노 등 전자공학에 관련된 질문을 무료회원가입 후 작성해주시면 전문가가 답변해드립니다.
ATMEGA128PWMLED초음파
아두이노AVR블루투스LCD
UART모터적외선ATMEGA
전체 스위치 센서
질문게시판 목록
제목 작성자 작성일 조회
질문 STM32F103 관련해서 질문드립니다.댓글[2] 27315co 18-07-30 12273
질문 아두이노 릴레이 펜 온오프 구동 질문 master 18-07-30 11249
질문 아두이노 구슬 가속도 및 속도 측정 질문 master 18-07-30 12049
질문 ADC값 저장 및 평균 비공개 18-07-29 10868
답변 답변글 답변 : ADC값 저장 및 평균댓글[1] master 18-07-29 11431
답변 답변글 답변 2: ADC값 저장 및 평균댓글[7] master 18-07-29 35094
질문 아두이노 switch문과 if문 질문 master 18-07-27 10721
질문 아두이노 코딩 오류 질문 master 18-07-27 10154
질문 아두이노 슬립모드 구현 방법 질문 master 18-07-26 18301
질문 ESP-01 AT COMMAND 질문 입니다.댓글[1] 도도리 18-07-26 13105
질문 소스 질문입니다댓글[3] 이미지첨부파일 민스타 18-07-26 16453
질문 a4988 모터제어 관련 질문드립니다. 첨부파일 uln2 18-07-25 10797
답변 답변글 답변 : a4988 모터제어 관련 질문드립니다.댓글[3] master 18-07-25 17581
질문 소스 질문입니다댓글[2] 이미지첨부파일 민스타 18-07-25 13806
질문 아두이노 명령어나 방법댓글[3] 양성민 18-07-24 18446
질문 센서값 수신 질문댓글[7] 비공개 18-07-24 36493
질문 16진수를 2진화 10진수 코드로 변경 질문 master 18-07-24 10998
질문 센서값 저장댓글[5] 비공개 18-07-23 23016
질문 아두이노 컴파일 오류 질문 master 18-07-23 11387
질문 아두이노 외부 전원제어 질문 master 18-07-23 12906
질문 아두이노 AUTO LIGHTING 시스템 질문 master 18-07-23 10801
질문 자동차 LED모듈을 만들고싶은데요 아두이노 질문 master 18-07-23 11874
질문 LED모듈 관련 질문 master 18-07-23 11215
질문 제작 의뢰도 가능한지요??댓글[2] 첨부파일 앤묘 18-07-22 13004
질문 납땜되어있는 소자 빼는 방법 질문 master 18-07-19 14188
질문 MCU 관련해서 질문 있습니다. 꽁준 18-07-18 11273
답변 답변글 답변 : MCU 관련해서 질문 있습니다. master 18-07-18 10806
질문 브릿지 다이오드 출력 전압 질문 master 18-07-18 12793
질문 8051 asm code를 c언어로 바꾸는 tool을 구할 수 있나요? master 18-07-18 9384
질문 아두이노 배터리 잔량 디스플레이 질문 master 18-07-18 14077
게시물 검색

2022년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2021년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2020년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2019년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2018년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
Privacy Policy
MCU BASIC ⓒ 2020
모바일버전으로보기