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

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

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


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

페이지 정보

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

조회수 7,568

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

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
모바일버전으로보기