lama Postat Mai 29, 2012 Partajează Postat Mai 29, 2012 Cam asa as vrea... Se poate observa ca, daca lcd-ul se intoarce cu fata in sus configuratia se pastreaza. quartz-ul e de 10 mhz.de aici l-am luat...poate imi mai dai cv indicatii...ms.http://www.ebay.com/itm/170633064850?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2648#ht_1183wt_952Stati sa inteleg: dvoastra vreti sa alimentati din pinul microcontrolerului?Parca un pin tine 25mA.Sa nu ardeti controlerul....... Link spre comentariu
Drk_alien Postat Mai 29, 2012 Autor Partajează Postat Mai 29, 2012 Incercati totusi sa imi faceti un demo.Nu cred ca se va arde nimik...dar totusi nu voi conecta vcc si gnd la iesirea microcontrolerului. Link spre comentariu
Drk_alien Postat Iunie 5, 2012 Autor Partajează Postat Iunie 5, 2012 Am reusit sa fac un cod care sa mearga cat de cat si sa vad ca se aprinda ori toti pixelii ori niciunul ori cate o linie... dar nimik perfect controlabil pt ca nu inteleg functia care imi scrie memoria lcd-ului. // LCD module connectionssbit sce at RB7_bit;sbit res at RB6_bit;sbit dc1 at RB5_bit;sbit sdin at RB4_bit;sbit sclk at RB3_bit;sbit sce_Direction at TRISB7_bit;sbit res_Direction at TRISB6_bit;sbit dc1_Direction at TRISB5_bit;sbit sdin_Direction at TRISB4_bit;sbit sclk_Direction at TRISB3_bit;// End LCD module connections void LCD_write_byte(unsigned char dt, unsigned char command){ unsigned char i; sce=0; dc1=command; for(i=0;i<8;i++) { if(dt&0x80) sdin=1; else sdin=0; dt=dt<<=1; sclk=0; sclk=1; } dc1=1; sce=1; sdin=1;}const unsigned char hanzi[]={0x3E, 0x51, 0x49, 0x45, 0x3E};const unsigned char imagine[]={0x3E, 0x51, 0x49, 0x45, 0x3E}; void LCD_set_XY(unsigned char X, unsigned char Y){ LCD_write_byte(0x40 | Y, 0);// column LCD_write_byte(0x80 | X, 0);// row}void LCD_innit(){ sce=1; res=1; delay_ms(1); res=0; delay_ms(1); res=1; LCD_write_byte(0x21,0);//³õʼ»¯Lcd,¹¦ÄÜÉ趨ʹÓÃÀ©³äÖ¸Áî LCD_write_byte(0xd9,0);//É趨Һ¾§Æ«Öõçѹ(¸ß--µÍ£© LCD_write_byte(0x20,0);//ʹÓûù±¾Ö¸Áî LCD_write_byte(0x0C,0);//É趨ÏÔʾģʽ£¬Õý³£ÏÔʾ}void main() {int i; TRISB = 0; LCD_innit(); delay_ms(4500); for(i=0; i<504; i++) { LCD_write_byte(0xff,0); } delay_ms(1500);} Ma poate ajuta cineva sa imi corecteze codul ca sa imi afiseze un cuvant pe ecran?...si sa imi explice ce se intampla in LCD_write_byte() ca sa stiu sa manipulez singur functia pe viitor.Va multumesc tare mult. Link spre comentariu
Liviu M Postat Iunie 6, 2012 Partajează Postat Iunie 6, 2012 for(i=0;i<8;i++) { if(dt&0x80) sdin=1; else sdin=0; dt=dt<<=1; sclk=0; sclk=1; }}[/code]La cod cred ca te pot ajuta eu putin, la restul nu.Banui ca probleme la intelegere iti ridica bucla for din functie.In bucla asta e testat fiecare bit din byte-ul de date (dt) incepand cu MSBit (bitul cel mai semnificativ, cel din stanga. Notatia standard pentru bitii unui byte e b7b6b5b4b3b2b1b0, MSB e b7).Operatia dt&0x80 este un SI logic intre byte-ul de date si b'10000000'; rezultatul operatiei e diferit de 0 (b'1000 0000) daca b7 = 1 si 0 daca b7 = 0. Asta testeaza si if-ul din bucla si face iesirea (sdin) 1 sau 0 in functie de valoarea lui b7. dt = dt<<=1; e gresit, ar trebui sa fie dt = dt<<1; este operatie de deplasare stanga si nu face altceva decat sa mute cu o pozitie (numarul de dupa << indica numarul de pozitii de deplasat) la stanga fiecare bit din dt. b7 se pierde, b6 devine b7, b5->b6... In felul asta se pot testa cu aceeasi operatie (dt&0x80) si ceilalti biti ai dt, pana se termina (8 cicluri ale lui for).scl0/scl1 genereaza clockul necesar comunicatiei. Link spre comentariu
Drk_alien Postat Iunie 6, 2012 Autor Partajează Postat Iunie 6, 2012 Chia daca iti vine sa crezi sau nu, dt=dt<<1 sau dt=dt<<=1 face la fel.nu primesc eroare iar codul rulat in ambele conditii ruleaza la fel.pe mine m-ar interesa mai mult cum as putea sa controlez mai precis pixelii lcd-ului.de ex daca vreau sa afisez caracterul "a" pe toata suprafata cred ca se face un array []={ 0x1f,0xca,....} si apoi se merge la coordonata dorita si cu functia lcd_ write se scrie.dar cum modific codul meu pt a face asta? Link spre comentariu
godFather89 Postat Iunie 6, 2012 Partajează Postat Iunie 6, 2012 Chia daca iti vine sa crezi sau nu, dt=dt<<1 sau dt=dt<<=1 face la fel.nu primesc eroare iar codul rulat in ambele conditii ruleaza la fel.dt = dt << 1; este echivalent cu dt <<= 1;dt = dt <<= 1; contine inca o atribuire. practic face dt<<=1 (dt = dt << 1) si apoi atribuie valoarea (din nou) lui dt. Probabil compilatorul isi da seama ca e degeaba si lasa doar dt <<= 1.pe mine m-ar interesa mai mult cum as putea sa controlez mai precis pixelii lcd-ului.de ex daca vreau sa afisez caracterul "a" pe toata suprafata cred ca se face un array []={ 0x1f,0xca,....} si apoi se merge la coordonata dorita si cu functia lcd_ write se scrie.dar cum modific codul meu pt a face asta?LCD_set_XY(0,0);LCD_write_byte(0x1F, 1);LCD_write_byte(0xCA, 1);...deoarece este un lcd grafic, ai nevoie de un font. Link spre comentariu
Liviu M Postat Iunie 6, 2012 Partajează Postat Iunie 6, 2012 Pe la inceputul topicului lama a pus un proiect cu lcd-ul asta. In fisierul 5110.c are un vector in care sunt "definite" caracterele ascii. Daca vrei o imagine personalizata trebuie s-o creezi din "bucatele" de dimensiunea unui caracter (din cate stiu eu, desi grafice displayurile astea tot cu "caractere" lucreaza), bucatele pe care ti le definesti dupa nevoi. Link spre comentariu
godFather89 Postat Iunie 6, 2012 Partajează Postat Iunie 6, 2012 Nu, sunt chiar grafice. Problema e ca trebuie sa trimiti datele a 8 pixeli (pe coloana) deodata. Uite aici un driver scris de ceva vreme pentru un display de nokia 3410. Poti desena imagini, patrate, text si pixeli. Este in C++ si l-am folosit pe un xmega, dar cu putine modificari merge pe orice. Link spre comentariu
Drk_alien Postat Iunie 6, 2012 Autor Partajează Postat Iunie 6, 2012 Nu cred ca e bun ecranul.Daca il misc imaginea joaca , pixelii au diferite contraste...adica imaginea nu e stabila deloc.cand il ating unii pixeli se aprind apoi dispar...habar nu am :-?? .Codul e bun.Cred ca am sa cumpar altul. Are cineva de vanzare de pe aici? Chiar nu am chef sa comand altul din china si sa ajunga peste 2 luni. Link spre comentariu
Liviu M Postat Iunie 6, 2012 Partajează Postat Iunie 6, 2012 Masa displayului e conectata sigur bine? Link spre comentariu
Drk_alien Postat Iunie 28, 2012 Autor Partajează Postat Iunie 28, 2012 Bun.......... .Am mai comandat inca un ecran, dupa ce l-am montat se comporta la fel ca cel pe care il credeam ca e busit .Am incercat sa scriu tot felul de caractere ca sa testez ecranul dar fara mari reusite.Am incercat sa afisez si niste imagini generate de un program.Ori imi afiseaza tot ecranul plin, ori pe jumatate....Se incapataneaza cineva sa ma ajute sa ii dau de cap?...ps: conexiunile sunt bine facute. Link spre comentariu
Drk_alien Postat Iunie 29, 2012 Autor Partajează Postat Iunie 29, 2012 Dupa ce am primit si cel de-al doilea ecran m-am gandit ca e posibil ca eu sa nu fac ceva bine, m-am pus pe verificat cod si consultat cu alte tutoriale Dupa vreo 2 ore in care am transpirat de numa am reusit sa fac urmatorul cod care sa mearga: // LCD module connectionssbit sce at RB7_bit;sbit res at RB6_bit;sbit dc1 at RB5_bit;sbit sdin at RB4_bit;sbit sclk at RB3_bit;sbit sce_Direction at TRISB7_bit;sbit res_Direction at TRISB6_bit;sbit dc1_Direction at TRISB5_bit;sbit sdin_Direction at TRISB4_bit;sbit sclk_Direction at TRISB3_bit;// End LCD module connections void LCD_write_byte(unsigned char dt, unsigned char command){ unsigned char i; sce=0; dc1=command; for(i=0;i<8;i++) { if(dt&0x80) sdin=1; else sdin=0; dt=dt<<1; sclk=0; sclk=1; } dc1=1; sce=1; sdin=1;}const char table[480] = { 0x00,0x00,0x00,0x00,0x00, // 20 space ASCII table for NOKIA LCD: 96 rows * 5 bytes= 480 bytes 0x00,0x00,0x5f,0x00,0x00, // 21 ! Note that this is the same set of codes for character you 0x00,0x07,0x00,0x07,0x00, // 22 " would find on a HD44780 based character LCD. 0x14,0x7f,0x14,0x7f,0x14, // 23 # Also, given the size of the LCD (84 pixels by 48 pixels), 0x24,0x2a,0x7f,0x2a,0x12, // 24 $ the maximum number of characters per row is only 14. 0x23,0x13,0x08,0x64,0x62, // 25 % 0x36,0x49,0x55,0x22,0x50, // 26 & 0x00,0x05,0x03,0x00,0x00, // 27 ' 0x00,0x1c,0x22,0x41,0x00, // 28 ( 0x00,0x41,0x22,0x1c,0x00, // 29 ) 0x14,0x08,0x3e,0x08,0x14, // 2a * 0x08,0x08,0x3e,0x08,0x08, // 2b + 0x00,0x50,0x30,0x00,0x00, // 2c , 0x08,0x08,0x08,0x08,0x08, // 2d - 0x00,0x60,0x60,0x00,0x00, // 2e . 0x20,0x10,0x08,0x04,0x02, // 2f / 0x3e,0x51,0x49,0x45,0x3e, // 30 0 0x00,0x42,0x7f,0x40,0x00, // 31 1 0x42,0x61,0x51,0x49,0x46, // 32 2 0x21,0x41,0x45,0x4b,0x31, // 33 3 0x18,0x14,0x12,0x7f,0x10, // 34 4 0x27,0x45,0x45,0x45,0x39, // 35 5 0x3c,0x4a,0x49,0x49,0x30, // 36 6 0x01,0x71,0x09,0x05,0x03, // 37 7 0x36,0x49,0x49,0x49,0x36, // 38 8 0x06,0x49,0x49,0x29,0x1e, // 39 9 0x00,0x36,0x36,0x00,0x00, // 3a : 0x00,0x56,0x36,0x00,0x00, // 3b ; 0x08,0x14,0x22,0x41,0x00, // 3c < 0x14,0x14,0x14,0x14,0x14, // 3d = 0x00,0x41,0x22,0x14,0x08, // 3e > 0x02,0x01,0x51,0x09,0x06, // 3f ? 0x32,0x49,0x79,0x41,0x3e, // 40 @ 0x7e,0x11,0x11,0x11,0x7e, // 41 A 0x7f,0x49,0x49,0x49,0x36, // 42 B 0x3e,0x41,0x41,0x41,0x22, // 43 C 0x7f,0x41,0x41,0x22,0x1c, // 44 D 0x7f,0x49,0x49,0x49,0x41, // 45 E 0x7f,0x09,0x09,0x09,0x01, // 46 F 0x3e,0x41,0x49,0x49,0x7a, // 47 G 0x7f,0x08,0x08,0x08,0x7f, // 48 H 0x00,0x41,0x7f,0x41,0x00, // 49 I 0x20,0x40,0x41,0x3f,0x01, // 4a J 0x7f,0x08,0x14,0x22,0x41, // 4b K 0x7f,0x40,0x40,0x40,0x40, // 4c L 0x7f,0x02,0x0c,0x02,0x7f, // 4d M 0x7f,0x04,0x08,0x10,0x7f, // 4e N 0x3e,0x41,0x41,0x41,0x3e, // 4f O 0x7f,0x09,0x09,0x09,0x06, // 50 P 0x3e,0x41,0x51,0x21,0x5e, // 51 Q 0x7f,0x09,0x19,0x29,0x46, // 52 R 0x46,0x49,0x49,0x49,0x31, // 53 S 0x01,0x01,0x7f,0x01,0x01, // 54 T 0x3f,0x40,0x40,0x40,0x3f, // 55 U 0x1f,0x20,0x40,0x20,0x1f, // 56 V 0x3f,0x40,0x38,0x40,0x3f, // 57 W 0x63,0x14,0x08,0x14,0x63, // 58 X 0x07,0x08,0x70,0x08,0x07, // 59 Y 0x61,0x51,0x49,0x45,0x43, // 5a Z 0x00,0x7f,0x41,0x41,0x00, // 5b [ 0x02,0x04,0x08,0x10,0x20, // 5c Yen Currency Sign 0x00,0x41,0x41,0x7f,0x00, // 5d ] 0x04,0x02,0x01,0x02,0x04, // 5e ^ 0x40,0x40,0x40,0x40,0x40, // 5f _ 0x00,0x01,0x02,0x04,0x00, // 60 ` 0x20,0x54,0x54,0x54,0x78, // 61 a 0x7f,0x48,0x44,0x44,0x38, // 62 b 0x38,0x44,0x44,0x44,0x20, // 63 c 0x38,0x44,0x44,0x48,0x7f, // 64 d 0x38,0x54,0x54,0x54,0x18, // 65 e 0x08,0x7e,0x09,0x01,0x02, // 66 f 0x0c,0x52,0x52,0x52,0x3e, // 67 g 0x7f,0x08,0x04,0x04,0x78, // 68 h 0x00,0x44,0x7d,0x40,0x00, // 69 i 0x20,0x40,0x44,0x3d,0x00, // 6a j 0x7f,0x10,0x28,0x44,0x00, // 6b k 0x00,0x41,0x7f,0x40,0x00, // 6c l 0x7c,0x04,0x18,0x04,0x78, // 6d m 0x7c,0x08,0x04,0x04,0x78, // 6e n 0x38,0x44,0x44,0x44,0x38, // 6f o 0x7c,0x14,0x14,0x14,0x08, // 70 p 0x08,0x14,0x14,0x18,0x7c, // 71 q 0x7c,0x08,0x04,0x04,0x08, // 72 r 0x48,0x54,0x54,0x54,0x20, // 73 s 0x04,0x3f,0x44,0x40,0x20, // 74 t 0x3c,0x40,0x40,0x20,0x7c, // 75 u 0x1c,0x20,0x40,0x20,0x1c, // 76 v 0x3c,0x40,0x30,0x40,0x3c, // 77 w 0x44,0x28,0x10,0x28,0x44, // 78 x 0x0c,0x50,0x50,0x50,0x3c, // 79 y 0x44,0x64,0x54,0x4c,0x44, // 7a z 0x00,0x08,0x36,0x41,0x00, // 7b < 0x00,0x00,0x7f,0x00,0x00, // 7c | 0x00,0x41,0x36,0x08,0x00, // 7d > 0x10,0x08,0x08,0x10,0x08, // 7e Right Arrow -> 0x78,0x46,0x41,0x46,0x78};const unsigned char imagine[]={ 0xFE , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01, 0x01 , 0xC1 , 0x61 , 0x21 , 0x21 , 0xA1 , 0xA1 , 0xA1, 0x61 , 0x61 , 0x61 , 0x51 , 0x51 , 0x49 , 0x49 , 0x41, 0x41 , 0x41 , 0xC1 , 0x41 , 0x41 , 0x41 , 0x41 , 0x01, 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01, 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01, 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01, 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01, 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01, 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01, 0x01 , 0x01 , 0x01 , 0xFE , 0xFF , 0x00 , 0x00 , 0x00, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x81 , 0x01 , 0x01, 0x01 , 0xC0 , 0xC0 , 0x40 , 0xC0 , 0x40 , 0x60 , 0xD8, 0x84 , 0x84 , 0xC2 , 0xFA , 0xBF , 0x87 , 0x81 , 0xE0, 0x60 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00, 0x00 , 0x00 , 0x80 , 0xF0 , 0xF8 , 0x1C , 0x04 , 0x04, 0x04 , 0x0C , 0x04 , 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 , 0xFF, 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x78 , 0x46 , 0x81, 0x81 , 0x47 , 0x6F , 0x30 , 0x10 , 0x08 , 0x04 , 0x02, 0x01 , 0x00 , 0x00 , 0x70 , 0xF8 , 0xFF , 0x9F , 0x81, 0x81 , 0x60 , 0x10 , 0x90 , 0x82 , 0xF2 , 0x7F , 0x1F, 0x04 , 0x02 , 0x72 , 0xFE , 0x9F , 0x47 , 0x00 , 0xF0, 0xFC , 0x9E , 0x86 , 0x42 , 0xE2 , 0xBE , 0xFF , 0x67, 0x10 , 0x80 , 0xC2 , 0xE2 , 0x3E , 0x0C , 0x04 , 0x02, 0x06 , 0x74 , 0xFE , 0x8F , 0x8B , 0x91 , 0x51 , 0x1E, 0x00 , 0x08 , 0x08 , 0xE4 , 0xFC , 0x44 , 0x20 , 0x38, 0xFE , 0xE2 , 0x30 , 0x08 , 0x04 , 0x03 , 0x07 , 0x00, 0x00 , 0x00 , 0x00 , 0xFF , 0xFF , 0x00 , 0x00 , 0x00, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00, 0x01 , 0x01 , 0x01 , 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 , 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 , 0x00 , 0x00 , 0x80 , 0x60 , 0x5C , 0x42 , 0x5C, 0x60 , 0x80 , 0x00 , 0xF8 , 0x10 , 0x08 , 0x00 , 0xF0, 0x08 , 0x08 , 0x90 , 0xFE , 0x00 , 0xF8 , 0x00 , 0x00, 0x80 , 0xF8 , 0x00 , 0xFA , 0x00 , 0xF8 , 0x08 , 0x08, 0x08 , 0xF0 , 0x00 , 0xF0 , 0x08 , 0x08 , 0x08 , 0xF0, 0x00 , 0x00 , 0x00 , 0x00 , 0xFE , 0x12 , 0x12 , 0x32, 0xD2 , 0x0C , 0x00 , 0xF0 , 0x08 , 0x08 , 0x08 , 0xF0, 0x00 , 0xF0 , 0x08 , 0x08 , 0x08 , 0x90 , 0x00 , 0xFE, 0x20 , 0xD0 , 0x08 , 0x00 , 0x90 , 0x28 , 0x28 , 0x48, 0x90 , 0x00 , 0x7E , 0x00 , 0x7E , 0x00 , 0x7E , 0x00, 0x7E , 0x00 , 0x00 , 0xFF , 0x7F , 0x80 , 0x80 , 0x81, 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x81 , 0x80 , 0x81, 0x80 , 0x80 , 0x80 , 0x80 , 0x81 , 0x81 , 0x80 , 0x81, 0x80 , 0x80 , 0x81 , 0x81 , 0x80 , 0x81 , 0x80 , 0x81, 0x80 , 0x81 , 0x80 , 0x80 , 0x80 , 0x81 , 0x80 , 0x80, 0x81 , 0x81 , 0x81 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80, 0x81 , 0x80 , 0x80 , 0x80 , 0x80 , 0x81 , 0x80 , 0x80, 0x81 , 0x81 , 0x81 , 0x80 , 0x80 , 0x80 , 0x81 , 0x81, 0x81 , 0x80 , 0x80 , 0x81 , 0x80 , 0x80 , 0x81 , 0x80, 0x80 , 0x81 , 0x81 , 0x81 , 0x80 , 0x80 , 0x81 , 0x80, 0x81 , 0x80 , 0x81 , 0x80 , 0x81 , 0x80 , 0x80 , 0x7F}; void clockdata(char bits_in){ int bitcnt; for (bitcnt=8; bitcnt>0; bitcnt--) { sclk = 0; //Set Clock Idle level LOW. if ((bits_in&0x80)==0x80) {sdin=1;} // PCD8544 clocks in theMSb first. else {sdin=0;} sclk = 1; //Data is clocked on the rising edge of SCK. bits_in=bits_in<<1; // Logicalshift data by 1 bit left. }} void writecom(char command_in){ dc1 = 0; // Select Command register. sce = 0; // Select Chip. clockdata(command_in); // Clock in command bits. sce = 1; // Deselect Chip.} void LCD_set_XY(unsigned char X, unsigned char Y){ writecom(0x40|(y&0x07)); // Y axis writecom(0x80|(x&0x7f)); // X axis}void writedata(unsigned char data_in){ dc1 = 1; // Select Data register. sce = 0; // Select Chip. clockdata(data_in); // Clock in data bits. sce = 1; // Deselect Chip.}void putchar(char character){ int tablept, count, char_column; if ((character<0x20)||(character>0x7f)) {return;} // Exit function if character is not found. tablept = ((5*character) - 160); // Point to the columns of the character in the table. for (count=5;count>0;count--) // Draw the columns to print the character. { char_column = table[tablept]; writedata(char_column); tablept++; } writedata(0x00); // 1 pixel spacing per character.} void putstr(const char *s){ while(*s) {putchar(*s++);} // Points to one ASCII to be written one at a time.} void clearram(void){ int ddram; LCD_set_XY(0,0); // Cursor Home. for (ddram=504;ddram>0;ddram--) {writedata(0x00);} // 6*84 = 504 DDRAMaddresses.}void LCD_innit(){ res = 1; // Set _RES HIGH. sce = 1; // Disable Chip. res = 0; // Reset the LCD. Delay_Ms(100); // Wait 100ms. res = 1; // Awake LCD from RESET state. writecom(0x21); // Activate Chip and H=1. writecom(0xC2); // Set LCD Voltage to about 7V. writecom(0x13); // Adjust voltage bias. writecom(0x20); // Horizontal addressing and H=0. writecom(0x09); // Activate all segments. clearram(); // Erase all pixel on the DDRAM. writecom(0x08); // Blank the Display. writecom(0x0C); // Display Normal. LCD_set_XY(0,0); // Cursor Home.}void main() {int i; TRISB = 0; LCD_innit(); LCD_set_XY(0,0); putstr("->PCD-8544 LCD "); putstr(" PCD-8544 LCD "); /* while(1) { for(i=0; i<504; i++) { writedata(imagine[i]); } } */} .Am pus codul in cazul un care cineva va avea nevoie. Am folosit MicroC PRO for PIC ver 5.4.0 si un pic16f877a .Bafta Link spre comentariu
Postări Recomandate
Creează un cont sau autentifică-te pentru a adăuga comentariu
Trebuie să fi un membru pentru a putea lăsa un comentariu.
Creează un cont
Înregistrează-te pentru un nou cont în comunitatea nostră. Este simplu!
Înregistrează un nou contAutentificare
Ai deja un cont? Autentifică-te aici.
Autentifică-te acum