Заглавная страница Избранные статьи Случайная статья Познавательные статьи Новые добавления Обратная связь FAQ Написать работу КАТЕГОРИИ: АрхеологияБиология Генетика География Информатика История Логика Маркетинг Математика Менеджмент Механика Педагогика Религия Социология Технологии Физика Философия Финансы Химия Экология ТОП 10 на сайте Приготовление дезинфицирующих растворов различной концентрацииТехника нижней прямой подачи мяча. Франко-прусская война (причины и последствия) Организация работы процедурного кабинета Смысловое и механическое запоминание, их место и роль в усвоении знаний Коммуникативные барьеры и пути их преодоления Обработка изделий медицинского назначения многократного применения Образцы текста публицистического стиля Четыре типа изменения баланса Задачи с ответами для Всероссийской олимпиады по праву Мы поможем в написании ваших работ! ЗНАЕТЕ ЛИ ВЫ?
Влияние общества на человека
Приготовление дезинфицирующих растворов различной концентрации Практические работы по географии для 6 класса Организация работы процедурного кабинета Изменения в неживой природе осенью Уборка процедурного кабинета Сольфеджио. Все правила по сольфеджио Балочные системы. Определение реакций опор и моментов защемления |
Eraldi fail tähtede jaoks.Содержание книги Поиск на нашем сайте
Eraldi fail tähtede jaoks. const char symbol[][5] = { {0x00,0x00,0x00,0x00,0x00}, //ļšīįåė {0x00,0x00,0x4f,0x00,0x00}, //! {0x00,0x07,0x00,0x07,0x00}, //" {0x14,0x7f,0x14,0x7f,0x14}, //# {0x24,0x2a,0x7f,0x2a,0x12}, //$ {0x23,0x13,0x08,0x64,0x62}, //% {0x36,0x49,0x55,0x22,0x40}, //& {0x00,0x05,0x03,0x00,0x00}, //, {0x00,0x1c,0x22,0x41,0x00}, //( {0x00,0x41,0x22,0x1c,0x00}, //) {0x14,0x08,0x3E,0x08,0x14}, //* {0x08,0x08,0x3E,0x08,0x08}, //+ {0x00,0x50,0x30,0x00,0x00}, //, {0x08,0x08,0x08,0x08,0x08}, //- {0x00,0x60,0x60,0x00,0x00}, //. {0x20,0x10,0x08,0x04,0x02}, /// {0x3e,0x51,0x49,0x45,0x3e}, //0 {0x00,0x42,0x7f,0x40,0x00}, //1 {0x42,0x61,0x51,0x49,0x46}, //2 {0x21,0x41,0x45,0x4b,0x31}, //3 {0x18,0x14,0x12,0x7f,0x10}, //4 {0x27,0x45,0x45,0x45,0x39}, //5 {0x3c,0x4a,0x49,0x49,0x30}, //6 {0x01,0x71,0x09,0x05,0x03}, //7 {0x36,0x49,0x49,0x49,0x36}, //8 {0x06,0x49,0x49,0x29,0x1e}, //9 {0x00,0x36,0x36,0x00,0x00}, //: {0x00,0x56,0x36,0x00,0x00}, //; {0x08,0x14,0x22,0x41,0x00}, //< {0x14,0x14,0x14,0x14,0x14}, //= {0x00,0x41,0x22,0x14,0x08}, //> {0x02,0x01,0x51,0x09,0x06}, //?
{0x32,0x49,0x71,0x41,0x3e}, //@ {0x7e,0x11,0x11,0x11,0x7e}, //A {0x7f,0x49,0x49,0x49,0x36}, //B {0x3e,0x41,0x41,0x41,0x22}, //C {0x7f,0x41,0x41,0x22,0x1c}, //D {0x7f,0x49,0x49,0x49,0x41}, //E {0x7f,0x09,0x09,0x09,0x01}, //F {0x3e,0x41,0x49,0x49,0x3a}, //G {0x7f,0x08,0x08,0x08,0x7f}, //H {0x00,0x41,0x7f,0x41,0x00}, //I {0x20,0x40,0x41,0x3f,0x01}, //J {0x7f,0x08,0x14,0x22,0x41}, //K {0x7f,0x40,0x40,0x40,0x40}, //L {0x7f,0x02,0x0c,0x02,0x7f}, //M {0x7f,0x04,0x08,0x10,0x7f}, //N {0x3e,0x41,0x41,0x41,0x3e}, //O
{0x7f,0x09,0x09,0x09,0x06}, //P {0x3e,0x41,0x51,0x21,0x5e}, //Q {0x7f,0x09,0x19,0x29,0x46}, //R {0x46,0x49,0x49,0x49,0x31}, //S {0x01,0x01,0x7f,0x01,0x01}, //T {0x3f,0x40,0x40,0x40,0x3f}, //U {0x1f,0x20,0x40,0x20,0x1f}, //V {0x3f,0x40,0x70,0x40,0x3f}, //W {0x63,0x14,0x08,0x14,0x63}, //X {0x07,0x08,0x70,0x08,0x07}, //Y {0x61,0x51,0x49,0x45,0x43}, //Z {0x00,0x7F,0x41,0x41,0x00}, //[ {0x02,0x04,0x08,0x10,0x20}, // - īįšąņķūé ńėżų {0x00,0x41,0x41,0x7F,0x00}, //] {0x04,0x02,0x01,0x02,0x04}, //^ {0x40,0x40,0x40,0x40,0x40}, //_
{0x00,0x01,0x02,0x04,0x00}, //' {0x20,0x54,0x54,0x54,0x78}, //a {0x7F,0x48,0x44,0x44,0x38}, //b {0x38,0x44,0x44,0x44,0x28}, //c {0x38,0x44,0x44,0x48,0x7F}, //d {0x38,0x54,0x54,0x54,0x18}, //e {0x08,0x7E,0x09,0x01,0x02}, //f {0x0C,0x52,0x52,0x52,0x3E}, //g {0x7F,0x08,0x04,0x04,0x78}, //h {0x00,0x44,0x7D,0x40,0x00}, //i {0x20,0x40,0x44,0x3D,0x00}, //j {0x7F,0x10,0x28,0x44,0x00}, //k {0x00,0x41,0x7F,0x40,0x00}, //l {0x7C,0x04,0x18,0x04,0x78}, //m {0x7C,0x08,0x04,0x04,0x78}, //n {0x38,0x44,0x44,0x44,0x38}, //o
{0x7C,0x14,0x14,0x14,0x08}, //p {0x08,0x14,0x14,0x18,0x7C}, //q {0x7C,0x08,0x04,0x04,0x08}, //r {0x48,0x54,0x54,0x54,0x20}, //s {0x04,0x3F,0x44,0x40,0x20}, //t {0x3C,0x40,0x40,0x20,0x7C}, //u {0x1C,0x20,0x40,0x20,0x1C}, //v {0x3C,0x40,0x30,0x40,0x3C}, //w {0x44,0x28,0x10,0x28,0x44}, //x {0x0C,0x50,0x50,0x50,0x3C}, //y {0x44,0x64,0x54,0x4C,0x44}, //z {0x00,0x08,0x36,0x41,0x00}, //{ {0x00,0x00,0x7f,0x00,0x00}, //| {0x00,0x41,0x36,0x08,0x00}, //} {0x02,0x01,0x02,0x02,0x01}, //~ {0x00,0x00,0x00,0x00,0x00}, //šåēåšā // 0x7f {0x7e,0x11,0x11,0x11,0x7e}, //A {0x7f,0x49,0x49,0x49,0x33}, //Į {0x7f,0x49,0x49,0x49,0x36}, //Ā {0x7f,0x01,0x01,0x01,0x03}, //Ć {0xe0,0x51,0x4f,0x41,0xff}, //Ä {0x7f,0x49,0x49,0x49,0x41}, //E {0x77,0x08,0x7f,0x08,0x77}, //Ę {0x41,0x49,0x49,0x49,0x36}, //Ē {0x7f,0x10,0x08,0x04,0x7f}, //Č {0x7c,0x21,0x12,0x09,0x7c}, //É {0x7f,0x08,0x14,0x22,0x41}, //K {0x20,0x41,0x3f,0x01,0x7f}, //Ė {0x7f,0x02,0x0c,0x02,0x7f}, //M {0x7f,0x08,0x08,0x08,0x7f}, //H {0x3e,0x41,0x41,0x41,0x3e}, //O {0x7f,0x01,0x01,0x01,0x7f}, //Ļ
{0x7f,0x09,0x09,0x09,0x06}, //P {0x3e,0x41,0x41,0x41,0x22}, //C {0x01,0x01,0x7f,0x01,0x01}, //T {0x47,0x28,0x10,0x08,0x07}, //Ó {0x1c,0x22,0x7f,0x22,0x1c}, //Ō {0x63,0x14,0x08,0x14,0x63}, //X {0x7f,0x40,0x40,0x40,0xff}, //Ö {0x07,0x08,0x08,0x08,0x7f}, //× {0x7f,0x40,0x7f,0x40,0x7f}, //Ų {0x7f,0x40,0x7f,0x40,0xff}, //Ł {0x01,0x7f,0x48,0x48,0x30}, //Ś {0x7f,0x48,0x30,0x00,0x7f}, //Ū {0x00,0x7f,0x48,0x48,0x30}, //Ż {0x22,0x41,0x49,0x49,0x3e}, //Ü {0x7f,0x08,0x3e,0x41,0x3e}, //Ž {0x46,0x29,0x19,0x09,0x7f}, //ß
{0x20,0x54,0x54,0x54,0x78}, //a {0x3c,0x4a,0x4a,0x49,0x31}, //į {0x7c,0x54,0x54,0x28,0x00}, //ā {0x7c,0x04,0x04,0x04,0x0c}, //ć {0xe0,0x54,0x4c,0x44,0xfc}, //ä {0x38,0x54,0x54,0x54,0x18}, //e {0x6c,0x10,0x7c,0x10,0x6c}, //ę {0x44,0x44,0x54,0x54,0x28}, //ē {0x7c,0x20,0x10,0x08,0x7c}, //č {0x7c,0x41,0x22,0x11,0x7c}, //é {0x7c,0x10,0x28,0x44,0x00}, //ź {0x20,0x44,0x3c,0x04,0x7c}, //ė {0x7c,0x08,0x10,0x08,0x7c}, //ģ {0x7c,0x10,0x10,0x10,0x7c}, //ķ {0x38,0x44,0x44,0x44,0x38}, //o {0x7c,0x04,0x04,0x04,0x7c}, //ļ
{0x7C,0x14,0x14,0x14,0x08}, //p {0x38,0x44,0x44,0x44,0x28}, //c {0x04,0x04,0x7c,0x04,0x04}, //ņ {0x0C,0x50,0x50,0x50,0x3C}, //ó {0x30,0x48,0xfc,0x48,0x30}, //ō {0x44,0x28,0x10,0x28,0x44}, //x {0x7c,0x40,0x40,0x40,0xfc}, //ö {0x0c,0x10,0x10,0x10,0x7c}, //÷ {0x7c,0x40,0x7c,0x40,0x7c}, //ų {0x7c,0x40,0x7c,0x40,0xfc}, //ł {0x04,0x7c,0x50,0x50,0x20}, //ś {0x7c,0x50,0x50,0x20,0x7c}, //ū {0x7c,0x50,0x50,0x20,0x00}, //ü {0x28,0x44,0x54,0x54,0x38}, //ż {0x7c,0x10,0x38,0x44,0x38}, //ž {0x08,0x54,0x34,0x14,0x7c}, //˙ //0xff };
Fail programmi jaoks #define F_CPU 1000000UL #include <avr/io.h> //prose I/O reg. Nimetusi #include <util/delay.h> // pausi tegemiseks #include "char.h" #include <avr/sleep.h> #include <avr/interrupt.h> //globaalse katkestuse alamprogramm //graafilise LCD ekraani seadistamiseks ja defineerimiseks //andmesiini rakendamine #define LCD_PORT PORTD #define LCD_DDR DDRD #define LCD_PIN PIND #define CMD_PORT PORTC #define CMD_DDR DDRC #define DI 2 //on sama mis RS (Data/Instruction) #define RW 4 // Read/write #define E 3 // Enable #define CS1 0 // Chip 1 select #define CS2 1 // Chip 2 select //neid momendil ei tea veel #define RST 3 //? #define CS 0//0 ili 1 - v zavisimosti on urovnja, kotorqm vklu4aetsa kontoller #define MODE 0// 0 - belqj fon i 4ernaja grafika, 1 - 4ernqj fon i belaja grafika //graafiline LCD ekraan void LCD12864_Com(unsigned char cmd) { LCD_PORT = cmd; _delay_us(1); CMD_PORT |= (1<<E); _delay_us(1); CMD_PORT &= ~(1<<E); _delay_us(1); }void LCD12864_Data(unsigned char data) { LCD_PORT = data; CMD_PORT |= (1<<DI); _delay_us(1); CMD_PORT |= (1<<E); _delay_us(1); CMD_PORT &= ~(1<<E); CMD_PORT &= ~(1<<DI); }void LCD12864_Clr() { if(CS==0) CMD_PORT &= ~((1<<CS1)|(1<<CS2));//Vkl oba kontrollera else CMD_PORT |= (1<<CS1)|(1<<CS2); for(unsigned char i=0; i<8; i++)//X { LCD12864_Com(0xB8+i); for(unsigned char j=0; j<64; j++)//Y { LCD12864_Com(0x40+j); if(MODE==0) LCD12864_Data(0x00); else LCD12864_Data(0xFF); } }if(CS==0) CMD_PORT |= (1<<CS1)|(1<<CS2);//Vqkl oba kontrollera else CMD_PORT &= ~((1<<CS1)|(1<<CS2)); }void LCD12864_GotoXY(unsigned char x, unsigned char y) { if(y<64) { if(CS==0) { CMD_PORT &= ~(1<<CS1); CMD_PORT |= (1<<CS2); }else { CMD_PORT |= (1<<CS1); CMD_PORT &= ~(1<<CS2); } }else { if(CS==0) { CMD_PORT &= ~(1<<CS2); CMD_PORT |= 1<<CS1; }else { CMD_PORT |= 1<<CS2; CMD_PORT &= ~(1<<CS1); } y=y-64; }LCD12864_Com(0xB8+x); LCD12864_Com(0x40+y); }void LCD12864_Init() { LCD_DDR = 0xFF; CMD_DDR |= (1<<DI)|(1<<RW)|(1<<E)|(1<<CS1)|(1<<CS2)|(1<<RST); if(CS==0) CMD_PORT |= (1<<RST); else CMD_PORT |=(1<<RST)|(1<<CS1)|(1<<CS2); _delay_us(100); //Vkl displey LCD12864_Com(0x3F); //Y=0 LCD12864_Com(0x40); //X=0 LCD12864_Com(0xB8); LCD12864_Com(0xC0); }void LCD12864_Point(unsigned char x, unsigned char y) { CMD_PORT |= (1<<RST); _delay_us(100); unsigned char pins=0; if((x>63)||(y>127)) return; LCD12864_GotoXY(x/8,y); LCD_PORT=0xFF; LCD_DDR=0x00; CMD_PORT |= (1<<RW)|(1<<DI); _delay_us(1); CMD_PORT |= (1<<E); _delay_us(1); CMD_PORT &= ~(1<<E); _delay_us(1); CMD_PORT |= (1<<E); _delay_us(1);//v realnom ustrojstve nuzno postavit 10mks, a v Proteuse - 1mks pins=LCD_PIN; CMD_PORT &= ~(1<<E); if(MODE==0) pins |= (1<<(x%8));// else pins &= ~(1<<(x%8)); CMD_PORT &= ~((1<<RW)|(1<<DI)); LCD_DDR = 0xFF; LCD12864_GotoXY(x/8,y); LCD12864_Data(pins); CMD_PORT |= (1<<RST); _delay_us(100); } int LCD12864_abs(int x) { if(x<0) return -x; else return x; } int LCD12864_sign(int x) { if(x<0) return -1; if(x>0) return 1; else return 0; } void LCD12864_Line(unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2) { int dX = LCD12864_abs(x2 - x1); int dY = LCD12864_abs(y2 - y1); int signX = LCD12864_sign(x2-x1); int signY = LCD12864_sign(y2-y1); int err = dX - dY; int err2; while(1) { LCD12864_Point(x1, y1); if(x1 == x2 && y1 == y2) break; err2 = err * 2; if(err2 > -dY) { err -= dY; x1 += signX; } if(err2 < dX) { err += dX; y1 += signY; } } } void LCD12864_Rect(unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2) { LCD12864_Line(x1,y1,x1,y2); LCD12864_Line(x1,y2,x2,y2); LCD12864_Line(x2,y2,x2,y1); LCD12864_Line(x2,y1,x1,y1); } void LCD12864_Ellipse(unsigned char x0, unsigned char y0, unsigned char radius) { int x = 0; int y = radius; int delta = 2 - 2 * radius; int error = 0; while(y >= 0) { LCD12864_Point(x0 + x, y0 + y); LCD12864_Point(x0 + x, y0 - y); LCD12864_Point(x0 - x, y0 + y); LCD12864_Point(x0 - x, y0 - y); error = 2 * (delta + y) - 1; if(delta < 0 && error <= 0) { ++x; delta += 2 * x + 1; continue; } error = 2 * (delta - x) - 1; if(delta > 0 && error > 0) { --y; delta += 1 - 2 * y; continue; }++x; delta += 2 * (x - y); --y; } } void LCD12864_Char(unsigned char x0, unsigned char y0, unsigned char code) { unsigned char x=x0;//0..8 - zadaem stroku, gde bukva vqvoditsa unsigned char y=y0; if(code<0x80) code-=0x20;//ustanovka na4ala standartnqh simvolov else code-=0x60;//ustanovka na4ala russkih simvolov if(CS==0) { CMD_PORT |= (1<<RST)|(1<<CS2); CMD_PORT &= ~(1<<CS1); }else { CMD_PORT |= (1<<RST)|(1<<CS1); CMD_PORT &= ~(1<<CS2); }if(x>63 || y>127) return; for(unsigned int i=0; i<5; i++) { LCD12864_GotoXY(x,y); if(i<=4) { if(MODE==0) LCD12864_Data(symbol[code][i]); else LCD12864_Data(~symbol[code][i]); } y+=1; } }void LCD12864_String( unsigned char x0,unsigned char y0,unsigned char* buffer, unsigned char count) { unsigned char x=x0; unsigned char y=y0; if((x>8)||(y>127)) return; LCD12864_GotoXY(x,y); for(unsigned char i=0; i<count; i++) { LCD12864_Char(x,y+6*i,buffer[i]); } } int main(void) { while(1) { unsigned char text1[] = "Karolin"; LCD12864_Init(); LCD12864_Clr(); LCD12864_String(0,64,text1,sizeof(text1)-1); unsigned char text2[] = "Vahtramae"; LCD12864_String(1,64,text2,sizeof(text2)-1); unsigned char text3[] = "AV12B"; LCD12864_String(2,64,text3,sizeof(text3)-1); unsigned char text4[] = "22."; LCD12864_String(7,111,text4,sizeof(text4)-1); unsigned char text5[] = "05.2015"; LCD12864_String(7,0,text5,sizeof(text5)-1);
LCD12864_Rect(0,15,15,0); LCD12864_Rect(15,31,31,15); LCD12864_Rect(31,46,46,31); LCD12864_Rect(46,61,61,46); LCD12864_Rect(0,31,15,46); LCD12864_Rect(15,46,31,61); LCD12864_Rect(46,64,61,79); LCD12864_Rect(31,79,46,94); LCD12864_Rect(46,94,61,109); // LCD12864_Line(32,64,64,64); //y telg, x telg, pikkus, lõppkoht // LCD12864_Line(0,0,63,127); // LCD12864_Line(63,0,0,127); // LCD12864_Ellipse(32,63,70); // LCD12864_Ellipse(70,63,32); } }
|
||||
Последнее изменение этой страницы: 2024-06-27; просмотров: 6; Нарушение авторского права страницы; Мы поможем в написании вашей работы! infopedia.su Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав. Обратная связь - 3.144.86.105 (0.008 с.) |