BASIC4MCU | 질문게시판 | 답변 : atmega128a 디지털시계 문의드립니다
페이지 정보
작성자 master 작성일2019-05-24 03:13 조회3,243회 댓글0건본문
// MCU BASIC: https://www.basic4mcu.com// DateTime : 2019-05-24 오전 3:15:50// by Ok-Hyun Park//#include <avr/io.h>#include "OK-128LCD.h"#include "OK-128TFT.h"#include "OK-128TFT_large.h"//prog_uchar S_font_large[128][210]={{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,//00x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//10x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,//20x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0xFE,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0F,0x0F,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0X00,0X00,0X00,0X00,0X00,0X00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0X00,0X00,0X00,0X00,0X00,0X00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,//30x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,//40x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x1F,0x1F,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,//50x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x1F,0x1F,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xFC,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//60x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xFC,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,//70x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,//80x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,//90x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x1F,0x1F,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,},{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },};prog_uchar X_font_large[128][168]={{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//세미콜론0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};unsigned char year,month,date,weekday,hour,minute,second;/*----------------------------------------------------------------------------*//*디지털 시계 관련 함수*//*----------------------------------------------------------------------------*///unsigned char DS1307_read(U08 address){ /*read DS1307*/unsigned char RxD;TWCR=0xA4; while(((TWCR&0x80)==0x00)||((TWSR&0xF8)!=0x08)); // START complete?TWDR=0xD0; TWCR=0x84; while(((TWCR&0x80)==0x00)||((TWSR&0xF8)!=0x18)); // SLA+W complete?TWDR=address; TWCR=0x84; while(((TWCR&0x80)==0x00)||((TWSR&0xF8)!=0x28)); // address complete?TWCR=0xA4; while(((TWCR&0x80)==0x00)||((TWSR&0xF8)!=0x10)); // START complete?TWDR=0xD1; TWCR=0x84; while(((TWCR&0x80)==0x00)||((TWSR&0xF8)!=0x40)); // SLA+R complete?TWCR=0x84; while(((TWCR&0x80)==0x00)||((TWSR&0xF8)!=0x58)); // data complete?RxD=TWDR; TWCR=0x94; Delay_us(10); // STOP conditionreturn RxD;}//void DS1307_write(U08 address,U08 TxD){ /*write DS1307*/TWCR=0xA4; while(((TWCR&0x80)==0x00)||((TWSR&0xF8)!=0x08)); // START complete?TWDR=0xD0; TWCR=0x84; while(((TWCR&0x80)==0x00)||((TWSR&0xF8)!=0x18)); // SLA+W complete?TWDR=address; TWCR=0x84; while(((TWCR&0x80)==0x00)||((TWSR&0xF8)!=0x28)); // address complete?TWDR=TxD; TWCR=0x84; while(((TWCR&0x80)==0x00)||((TWSR&0xF8)!=0x28)); // data complete?TWCR=0x94; Delay_us(10); // STOP condition}//void Display_time(void){ /*display DS1307 time*/TFT_xy( 9,7); TFT_color(Silver,Black); TFT_hexadecimal_large(0x20,2); year=DS1307_read(0x06); TFT_hexadecimal_large(year,2); // display yearTFT_xy(14,7); TFT_color(Silver,Black); month=DS1307_read(0x05); TFT_hexadecimal_large(month,2); // display monthTFT_xy(17,7); TFT_color(Silver,Black); date=DS1307_read(0x04); TFT_hexadecimal_large(date,2); // display date//weekday=DS1307_read(0x03); // display weekdayif (weekday==0x01)TFT_string_large(8,11,Orange,Black,"일");else if(weekday==0x02)TFT_string_large(8,11,Orange,Black,"월");else if(weekday==0x03)TFT_string_large(8,11,Orange,Black,"화");else if(weekday==0x04)TFT_string_large(8,11,Orange,Black,"수");else if(weekday==0x05)TFT_string_large(8,11,Orange,Black,"목");else if(weekday==0x06)TFT_string_large(8,11,Orange,Black,"금");else if(weekday==0x07)TFT_string_large(8,11,Orange,Black,"토");//TFT_xy(10,18); TFT_color(Green,Black); hour=DS1307_read(0x02); TFT_hexadecimal_large(hour&0x1F,2); // display hour//if((hour&0x20)==0x00)TFT_string_large(18,11,LightGrey,Black,"전"); else TFT_string_large(18,11,LightGrey,Black,"후");//TFT_xy(13,18); TFT_color(Green,Black); minute=DS1307_read(0x01); TFT_hexadecimal_large(minute,2); // display minuteTFT_xy(16,18); TFT_color(Green,Black); second=DS1307_read(0x00); TFT_hexadecimal_large(second&0x7F,2); // display secondTFT_xy(19,18); TFT_color(Green,Black); TFT_English_large(' '); // display home}//unsigned char BCD_increment(U08 number){ /*BCD increment*/unsigned char i;i=(number>>4)*10+(number&0x0F); // convert BCD to binaryi++; // incrmenti=((i/10)<<4)+(i%10); // convert binary to BCDreturn i;}//unsigned char BCD_decrement(U08 number){ /*BCD decrement*/unsigned char i;i=(number>>4)*10+(number&0x0F); // convert BCD to binaryi--; // decrementi=((i/10)<<4)+(i%10); // convert binary to BCDreturn i;}//void Cursor_left(void){ /*go cursor left*/if ((Xcursor==17)&&(Ycursor==21)){ Xcursor=14; Ycursor=21; }else if((Xcursor==14)&&(Ycursor==21)){ Xcursor=11; Ycursor=21; }else if((Xcursor==11)&&(Ycursor==21)){ Xcursor= 8; Ycursor=21; }else if((Xcursor== 8)&&(Ycursor==21)){ Xcursor= 5; Ycursor=21; }else if((Xcursor== 5)&&(Ycursor==21)){ Xcursor=14; Ycursor=16; }else if((Xcursor==14)&&(Ycursor==16)){ Xcursor=11; Ycursor=16; }else if((Xcursor==11)&&(Ycursor==16)){ Xcursor= 8; Ycursor=16; }else if((Xcursor== 8)&&(Ycursor==16)){ Xcursor= 5; Ycursor=16; }else if((Xcursor== 5)&&(Ycursor==16)){ Xcursor=17; Ycursor=21; }}//void Cursor_right(void){ /*go cursor right*/if ((Xcursor==17)&&(Ycursor==21)){ Xcursor= 5; Ycursor=16; }else if((Xcursor== 5)&&(Ycursor==16)){ Xcursor= 8; Ycursor=16; }else if((Xcursor== 8)&&(Ycursor==16)){ Xcursor=11; Ycursor=16; }else if((Xcursor==11)&&(Ycursor==16)){ Xcursor=14; Ycursor=16; }else if((Xcursor==14)&&(Ycursor==16)){ Xcursor= 5; Ycursor=21; }else if((Xcursor== 5)&&(Ycursor==21)){ Xcursor= 8; Ycursor=21; }else if((Xcursor== 8)&&(Ycursor==21)){ Xcursor=11; Ycursor=21; }else if((Xcursor==11)&&(Ycursor==21)){ Xcursor=14; Ycursor=21; }else if((Xcursor==14)&&(Ycursor==21)){ Xcursor=17; Ycursor=21; }}//void Increment(void){ /*increment time*/if((Xcursor==5)&&(Ycursor==16)){ // in case of yearyear=DS1307_read(0x06);if(year==0x99)year=0x00; else year=BCD_increment(year);DS1307_write(0x06,year);}else if((Xcursor==8)&&(Ycursor==16)){ // in case of monthmonth=DS1307_read(0x05);if(month==0x12)month=0x01; else month=BCD_increment(month);DS1307_write(0x05,month);}else if((Xcursor==11)&&(Ycursor==16)){ // in case of datedate=DS1307_read(0x04);if(date==0x31)date=0x01; else date=BCD_increment(date);DS1307_write(0x04,date);}else if((Xcursor==14)&&(Ycursor==16)){ // in case of weekdayweekday=DS1307_read(0x03);if(weekday==0x07)weekday=0x01; else weekday++;DS1307_write(0x03,weekday);}else if((Xcursor==5)&&(Ycursor==21)){ // in case of AM/PMhour=DS1307_read(0x02);if((hour&0x20)==0x00)hour|=0x20; else hour&=0xDF;DS1307_write(0x02,hour);}else if((Xcursor==8)&&(Ycursor==21)){ // in case of hourhour=DS1307_read(0x02);if((hour&0x1F)==0x12)hour=(hour&0xE0)+0x01; else hour=BCD_increment(hour);DS1307_write(0x02,hour);}else if((Xcursor==11)&&(Ycursor==21)){ // in case of minuteminute=DS1307_read(0x01);if(minute==0x59)minute=0x00; else minute=BCD_increment(minute);DS1307_write(0x01,minute);}else if((Xcursor==14)&&(Ycursor==21)){ // in case of secondsecond=DS1307_read(0x00);if(second==0x59)second=0x00; else second=BCD_increment(second);DS1307_write(0x00,second);}}//void Decrement(void){ /*decrement time*/if((Xcursor==5)&&(Ycursor==16)){ // in case of yearyear=DS1307_read(0x06); if(year==0x00)year=0x99; else year=BCD_decrement(year); DS1307_write(0x06,year);}else if((Xcursor==8)&&(Ycursor==16)){ // in case of monthmonth=DS1307_read(0x05); if(month==0x01)month=0x12; else month=BCD_decrement(month); DS1307_write(0x05,month);}else if((Xcursor==11)&&(Ycursor==16)){ // in case of datedate=DS1307_read(0x04); if(date==0x01)date=0x31; else date=BCD_decrement(date); DS1307_write(0x04,date);}else if((Xcursor==14)&&(Ycursor==16)){ // in case of weekdayweekday=DS1307_read(0x03); if(weekday==0x01)weekday=0x07; else weekday--; DS1307_write(0x03,weekday);}else if((Xcursor==5)&&(Ycursor==21)){ // in case of AM/PMhour=DS1307_read(0x02); if((hour&0x20)==0x00)hour|=0x20; else hour&=0xDF; DS1307_write(0x02,hour);}else if((Xcursor==8)&&(Ycursor==21)){ // in case of hourhour=DS1307_read(0x02); if((hour&0x1F)==0x01)hour=(hour&0xE0)+0x12; else hour=BCD_decrement(hour); DS1307_write(0x02,hour);}else if((Xcursor==11)&&(Ycursor==21)){ // in case of minuteminute=DS1307_read(0x01); if(minute==0x00)minute=0x59; else minute=BCD_decrement(minute); DS1307_write(0x01,minute);}else if((Xcursor==14)&&(Ycursor==21)){ // in case of secondsecond=DS1307_read(0x00); if(second==0x00)second=0x59; else second=BCD_decrement(second); DS1307_write(0x00,second);}}//void DS1307_initialize(void){ /*initialize DS1307 RTC*/TWBR=18; TWSR=0x01; // 100kHz(TWBR=18,TWPS=1)second=DS1307_read(0x00); // if CH=1,initializehour=DS1307_read(0x02); // if 24 hour system,initializeif(((second&0x80)==0x80)||((hour&0x40)==0x00)){DS1307_write(0x00,0x00); // second=0x00DS1307_write(0x01,0x00); // minute=0x00DS1307_write(0x02,0x12|0x40); // hour=0x12 AM(12 hour system)DS1307_write(0x03,0x01); // weekday=0x01(Sunday)DS1307_write(0x04,0x05); // date=0x05DS1307_write(0x05,0x12); // month=0x12DS1307_write(0x06,0x10); // year=0x2010}}//void TFT_landscape_largey(void){ //set landscape modeTFT_write(0x16,0x0068); // MV=1,MX=1,MY=0,BGR=1TFT_write(0x02,0x0000); TFT_write(0x03,0x0000); TFT_write(0x04,0x0001); TFT_write(0x05,0x003F); // x=0~319TFT_write(0x06,0x0000); TFT_write(0x07,0x0000); TFT_write(0x08,0x0000); TFT_write(0x09,0x00EF); // y=0~239XcharacterLimit=26; YcharacterLimit=30; // 40x30 character unitScreenMode='L';}//void TFT_string_largey(U08 xChar,U08 yChar,U16 colorfore,U16 colorback,char*str){ // write TFT-LCD stringunsigned char ch1; unsigned int ch2;Xcharacter=xChar; Ycharacter=yChar; foreground=colorfore; background=colorback;while(*str){ch1=*str++;if(ch1<0x80)TFT_English_large(ch1); // English ASCII characterelse{ // Koreanch2=(ch1<<8)+(*str++); ch2=KS_code_conversion(ch2); TFT_Korean_large(ch2); // convert KSSM(완성형)to KS(조합형)}}}//void TFT_English_largey(U08 code){ // write a English ASCII character(12x24 pixel)unsigned char data,x,y;unsigned int pixel[30][56];//unsigned int dot0,dot1,dot2,dot3,dot4;for(x=0; x<30; x++){ // read English ASCII fontdata=pgm_read_byte(&S_font_large[code][x]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y]=foreground; else pixel[x][y]=background; }}for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+15]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+8]=foreground; else pixel[x][y+8]=background; }}for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+30]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+16]=foreground; else pixel[x][y+16]=background; }}/*for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+24]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+24]=foreground; else pixel[x][y+24]=background; }}for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+32]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+32]=foreground; else pixel[x][y+32]=background; }}for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+40]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+40]=foreground; else pixel[x][y+40]=background; }}for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+48]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+48]=foreground; else pixel[x][y+48]=background; }}for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+56]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+56]=foreground; else pixel[x][y+56]=background; }}*//*if(outline_flag==1){ // display outlinefor(x=0; x<12; x++){dot0=pgm_read_byte(&E_font_large[code][x])+pgm_read_byte(&E_font_large[code][x+12])*256;dot1=dot0>>1; // up sidedot2=dot0; // down sidedot3=pgm_read_byte(&E_font_large[code][x+1])+pgm_read_byte(&E_font_large[code][x+13])*256; // left sidedot4=pgm_read_byte(&E_font_large[code][x-1])+pgm_read_byte(&E_font_large[code][x+11])*256; // right sidefor(y=0; y<16; y++){if(!(dot0&0x0001)){if( dot1&0x0001)pixel[x][y]=outline;if( dot2&0x0001)pixel[x][y]=outline;if((dot3&0x0001)&&(x<11))pixel[x][y]=outline;if((dot4&0x0001)&&(x> 0))pixel[x][y]=outline;}dot1>>=1; dot2=dot0; dot0>>=1; dot3>>=1; dot4>>=1;}}for(x=0; x<12; x++){dot0=pgm_read_byte(&E_font_large[code][x+12])+pgm_read_byte(&E_font_large[code][x+24])*256;dot1=dot0>>1; // up sidedot2=dot0; // down sidedot3=pgm_read_byte(&E_font_large[code][x+13])+pgm_read_byte(&E_font_large[code][x+25])*256; // left sidedot4=pgm_read_byte(&E_font_large[code][x+11])+pgm_read_byte(&E_font_large[code][x+23])*256; // right sidefor(y=0; y<16; y++){if(!(dot0&0x0001)){if( dot1&0x0001)pixel[x][y+8]=outline;if( dot2&0x0001)pixel[x][y+8]=outline;if((dot3&0x0001)&&(x<11))pixel[x][y+8]=outline;if((dot4&0x0001)&&(x> 0))pixel[x][y+8]=outline;}dot1>>=1; dot2=dot0; dot0>>=1; dot3>>=1; dot4>>=1;}}}*/if(Xcharacter>=XcharacterLimit){ // end of line?Xcharacter=0; Ycharacter+=3;if(Ycharacter>=(YcharacterLimit-2))Ycharacter=0; // end of screen?}if(underscore_flag==1){for(x=0; x<12; x++)pixel[x][23]=underscore; // display underscore}if((cursor_flag==1)&&(Xcharacter==Xcursor)&&(Ycharacter==Ycursor)){for(x=0; x<12; x++){ pixel[x][22]=cursor; pixel[x][23]=cursor; } // display cursor}for(y=0; y<24; y++){ // write a characterfor(x=0; x<12; x++)TFT_pixel(Xcharacter*12+x,Ycharacter*8+y,pixel[x][y]);}Xcharacter+=1; // go to next position}//void TFT_0x_hexadecimal_largey(U32 number,U08 digit){ // display hexadecimal number with 0xunsigned char i,character;if((digit==0)||(digit>8))return;TFT_English_large('0'); TFT_English_large('x');for(i=digit; i>0; i--){character=(number>>4*(i-1))&0x0F;if(character<10)TFT_English_large(character+'0'); else TFT_English_large(character-10+'A');}}//int main(void){unsigned char key;MCU_initialize(); // initialize MCU and kitDelay_ms(50); // wait for system stabilizationLCD_initialize(); // initialize text LCD moduleTFT_initialize(); // initialize TFT-LCD module//Beep();LCD_string(0x80," OK-128TFT V1.0 ");LCD_string(0xC0," Exp19_2R.c ");TFT_cursor(White);Xcursor=17; Ycursor=21;TFT_landscape();TFT_string(10,3,Violet,Black," 홍길동의 디지털 시계 "); // display titleTFT_string_large( 9, 7,Silver ,Black,"2019/05/22 ");TFT_string_large( 7,11,Orange ,Black,"(수요일)");TFT_string_large(16,11,LightGrey,Black,"오후 ");TFT_string_large(10,18,Green ,Black,"01: 00: 00");TFT_string_large( 0,27,Magenta ,Black,"*******(제작: 홍길동)*******");DS1307_initialize();while(1){key=Key_input(); // key inputswitch(key){case KEY1: Cursor_left(); break; // if KEY1,go cursor leftcase KEY2: Cursor_right(); break; // if KEY2,go cursor rightcase KEY3: Increment(); break; // if KEY3,increment timecase KEY4: Decrement(); break; // if KEY4,decrement timedefault : Display_time(); break; // display time}}}이부분에서,LCD화면에 제가만든 폰트가 출력되도록 하고싶은데,TFT_English부분의 숫자를 바꿔봐도 아무것도 바뀌지않습니다,,
폰트 부분의 코드에서 0~9와 세미콜론만 사용하기위해 앞부분의 38개는 빈칸으로 배열선언하였고,뒷부분은 70개의 배열로 빈칸선언하였습니다
마스터님의 말씀대로 헤더파일을 분석해본결과 void함수 void TFT_landscape_largey(void),void TFT_string_largey(U08 xChar,U08 yChar,U16 colorfore,U16 colorback,char*str)
void TFT_English_largey(U08 code),void TFT_0x_hexadecimal_largey(U32 number,U08 digit)
4개를 잘 조합해야 제가만든 폰트 시계가 출력될것같은데,도저히 감이 안잡혀서 이렇게 질문을 드립니다ㅠㅜ
//
폰트 자체를 만드는 것이 아니고
원하는 폰트만 출력하고 싶다는 것일까요?
//
아직도 전체 소스가 아닌가봅니다.
TFT_English_large()
TFT_English_largey()
함수 이름이 다르므로 다른 함수입니다.
어째서 이름이 다를까요?
컴파일 해보지 않았나보군요
//
for(x=0; x<30; x++){ // read English ASCII fontdata=pgm_read_byte(&S_font_large[code][x]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y]=foreground; else pixel[x][y]=background; }}for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+15]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+8]=foreground; else pixel[x][y+8]=background; }}for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+30]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+16]=foreground; else pixel[x][y+16]=background; }}/*for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+24]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+24]=foreground; else pixel[x][y+24]=background; }}for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+32]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+32]=foreground; else pixel[x][y+32]=background; }}for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+40]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+40]=foreground; else pixel[x][y+40]=background; }}for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+48]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+48]=foreground; else pixel[x][y+48]=background; }}for(x=0; x<30; x++){data=pgm_read_byte(&S_font_large[code][x+56]); for(y=0; y<8; y++){ if(data&(1<<y))pixel[x][y+56]=foreground; else pixel[x][y+56]=background; }}*/
TFT_English_largey() 함수에보면 7개의 for()문 중 4개를 주석처리 했습니다.
위 3개만으로도 정상적으로 문자 출력이 되나보죠?
pixel[][] 배열에 값을 넣고 있는데
배열을 LCD에 출력하는 함수가 없습니다.
전체소스를 첨부하지 않으면 분석이 안됩니다.
폴더째 압축해서 첨부하세요
댓글 0
조회수 3,243등록된 댓글이 없습니다.