Sari la conținut
ELFORUM - Forumul electronistilor

16f877 + LCD


Vizitator abarbu

Postări Recomandate

Vizitator abarbu

nu stiu cum sa scriu ceva pe LCD. LCD-ul e luat de la conexelectronic si mie mi se pare cam noname. se numeste: DEM 16216 SGH si are un controller KS0070B-B0. am incercat driverele din CCS C si nu merg (cred ca sunt pt hyundai). aveti idee cum pot sa il conving sa scrie ceva ?in plus el mai are niste conectori (V+, V- + si -) care nu apar in documentatie. in rest am documentatia pentru toti cei 16 pini care contin si VSS si VDD. multumesc mult.

Link spre comentariu
Vizitator sev7en

aici ai foaia de catalog al controllerului de LCD

http://www.ee.oulu.fi/research/tklab/co ... r-3316.pdf

iar aici ai o foaie de catalog pentru o familie de afisaje. Unul dintre ele este cel cautat de tine.

http://www.ryston.cz/pdf/display/display.pdf

Daca poti spune ce ai legat la pinul 3 al afisajului. Este pinul de contrast. Daca afisajul este pentru gama extinsa de temperaturi atunci tensiunea de pe pinul 3 poate sa fie negativa.

 

sev7en

Link spre comentariu
Vizitator abarbu

si are cineva niste drivere scrise pentru asa ceva ?pinul 3 l-am lasat neconectat. in datasheet zice power supply for liquid Crystal Drive. sa il pun tot 5 V ? in datasheet zice ca poate sa fie intre 3 si 10 V.

Link spre comentariu
Vizitator sev7en

si are cineva niste drivere scrise pentru asa ceva ?pinul 3 l-am lasat neconectat. in datasheet zice power supply for liquid Crystal Drive. sa il pun tot 5 V ? in datasheet zice ca poate sa fie intre 3 si 10 V.

Lasa pinul 3 neconectat deocamdata. Masoara cu un voltmetru tensiunea intre pinul 3 si pinul de masa al afisajului. Asta ca sa elimini situatia in care afisajul face singur aceasta tensiune. Sustin in continuare ca tensiunea pe pinul 3 trebuie sa fie negativa.In cel mai bun caz poti sa-l legi la masa, dar nu cred ca este de ajuns.In data sheet scrie la wide temp model (Vdd-V0) = typ. 6,8V. Daca Vdd=5V atunci 5-V0 =6,8 => V0=5-6,8=-1,8. Atat trebuie sa fie tensiunea pe pinul 3 al afisajului. Dar, verifica daca cumva aceasta tensiune nu este generata chiar de afisaj. Atunci buba este in alta parte.Daca nu este prezenta o tensiune de aprox -1,8V trebuie s-o generezi cu un circ. extern. Gata. sev7en
Link spre comentariu
Vizitator abarbu

tensiunea de pe pinul 3 este de 0.8V-1V. in orice caz acel 1V este o tensiune pozitiva. si inca ceva ciudat, uneori creste la 1.5V (dar pentru putin timp: 1/2s). tens de pe pinul 3 tb sa fie pozitiva pentru ca Vdd-V0=6.8 doar pentru normal temp. pentru wide temp zice ca Vlcd=6.8 (insa pe de alta parte la mine e aproape 1V).pe spatele afisajului mai am niste jumperi care sunt nedocumentati (exact ca si cei 4 conectori: v+ v- + si -). m-am uitat in datasheet si modelul de LCD este intr-adevar wide temp range si este indicata o schema in care pinul 3 nu se leaga nicaieri. asta inseamna (exact cum ziceai tu) ca isi face el tensiunea dorita. la mine insa nu vrea. chiar nu stiu ce sa fac.

Link spre comentariu
Vizitator dgfx

Intre masa + si pinu 3 trebuie sa legi un semireglabil de 10K - 20K si sa invarti de el cu afisajul alimentat pana vezi ca apare ceva pe ecran (de obicei primu rand negru). Mai jos ai codu de 4 bit in P2 pentru 16F84program hd44780;//* *///* Interface : SEL = Port A bit 3 *///* WR = Port A bit 2 *///* RS = Port A bit 1 *///* Data_7 = Port B bit 7 *///* Data_6 = Port B bit 6 *///* Data_5 = Port B bit 5 *///* Data_4 = Port B bit 4 */ //* General definitions */#pragma CLOCK_FREQ 20000000//#define TRISA 5//#define TRISB 6//#define PORTA 5//#define PORTB 6//***********************************************************************///* Definitions for the LCD interface *///***********************************************************************/#define LCD_SEL 2 //* Port A bit 3 ( Enables LCD ) */#define LCD_WR 1 //* Port A bit 2 ( Logic 0 = Write ) */#define LCD_RS 0 //* Port A bit 1 ( Register select ) */#define LCD_DATA_4 4 //* LCD BIT 4 */#define LCD_DATA_5 5 //* LCD BIT 5 */#define LCD_DATA_6 6 //* LCD BIT 6 */#define LCD_DATA_7 7 //* LCD BIT 7 *///* *///* *///***********************************************************************///* LCD Commands ( Refer to LCD Data Sheet ) *///* Standard command should work with most common devices */ //***********************************************************************///* */#define clear_lcd 0x01 //* Clear Display */#define return_home 0x02 //* Cursor to Home position */#define entry_mode 0x06 //* Normal entry mode */#define entry_mode_shift 0x07 //* - with shift */#define system_set_8_bit 0x38 //* 8 bit data mode 2 line ( 5x7 font ) */#define system_set_4_bit 0x28 //* 4 bit data mode 2 line ( 5x7 font ) */#define display_on 0x0c //* Switch ON Display */#define display_off 0x08 //* Cursor plus blink */#define set_dd_line1 0x80 //* Line 1 position 1 */#define set_dd_line2 0xC0 //* Line 2 position 1 */#define set_dd_ram 0x80 //* Line 1 position 1 */#define write_data 0x00 //* With RS = 1 */#define cursor_on 0x0E //* Switch Cursor ON */#define cursor_off 0x0C //* Switch Cursor OFF *///* *///***********************************************************************///* PIC PORT SETUP */#define TxMode 0x40 //* Set option reg TMR0 interupt */ //* source from counter. */ //* Max speed prescaler ( 1:2 ) */ //* ( Not needed for LCD ) */ #define PortAConfig 0x00 //* Configure port A ( 1 = input ) */ //* RA4/RTCC = Input / RA2 = Input */ #define PortBConfig 0x00 //* Configure port B *///***********************************///* LCD timing delay *///* Adjust for your LCD *///***********************************/procedure LCD_Delay;begin delay_ms(1);end;//***********************************///* Put LCD in Function Mode *///***********************************/procedure LCD_FunctionMode;begin output_low_port_a( LCD_RS ); LCD_Delay;end;//***********************************///* Put LCD in Data Mode *///***********************************/procedure LCD_DataMode;begin output_high_port_a( LCD_RS ); LCD_Delay();end;//***********************************///* Write a single byte to the LCD *///* 8 Bit Mode *///***********************************/procedure LCD_Write_8_Bit(d: char );begin output_low_port_a( LCD_WR ); //* Write Mode */ LCD_Delay(); //* Setup data */ if ( d & 0x80 ) then output_high_port_b( LCD_DATA_7 ); else output_low_port_b( LCD_DATA_7 ); if ( d & 0x40 ) then output_high_port_b( LCD_DATA_6 ); else output_low_port_b( LCD_DATA_6 ); if ( d & 0x20 ) then output_high_port_b( LCD_DATA_5 ); else output_low_port_b( LCD_DATA_5 ); if ( d & 0x10 ) then output_high_port_b( LCD_DATA_4 ); else output_low_port_b( LCD_DATA_4 ); LCD_Delay(); output_high_port_a( LCD_SEL ); //* Select LCD */ LCD_Delay(); output_low_port_a( LCD_SEL ); //* De-select LCD */end;//***********************************///* Write a single byte to the LCD *///* 4 Bit Mode *///***********************************/procedure LCD_Write_4_Bit(d: char );begin output_low_port_a( LCD_WR ); //* Write Mode */ LCD_Delay; //* Output Higher 4 bits */ if ( d & 0x80 ) then output_high_port_b( LCD_DATA_7 ); else output_low_port_b( LCD_DATA_7 ); if ( d & 0x40 ) then output_high_port_b( LCD_DATA_6 ); else output_low_port_b( LCD_DATA_6 ); if ( d & 0x20 ) then output_high_port_b( LCD_DATA_5 ); else output_low_port_b( LCD_DATA_5 ); if ( d & 0x10 ) then output_high_port_b( LCD_DATA_4 ); else output_low_port_b( LCD_DATA_4 ); LCD_Delay; output_high_port_a( LCD_SEL ); LCD_Delay; output_low_port_a( LCD_SEL ); //* Clock in the data */ LCD_Delay; d := d << 4; //* Output Lower 4 bits */ if ( d & 0x80 ) then output_high_port_b( LCD_DATA_7 ); else output_low_port_b( LCD_DATA_7 ); if ( d & 0x40 ) then output_high_port_b( LCD_DATA_6 ); else output_low_port_b( LCD_DATA_6 ); if ( d & 0x20 ) then output_high_port_b( LCD_DATA_5 ); else output_low_port_b( LCD_DATA_5 ); if ( d & 0x10 ) then output_high_port_b( LCD_DATA_4 ); else output_low_port_b( LCD_DATA_4 ); LCD_Delay; output_high_port_a( LCD_SEL ); LCD_Delay; output_low_port_a( LCD_SEL ); //* Clock in the data */end;//***********************************///* Setup the lcd device *///***********************************/procedure LCD_Setup;begin //* Reset the LCD */ delay_ms(40); //* Power up delay */ LCD_FunctionMode(); LCD_Write_8_Bit( system_set_4_bit ); //* This sequence resets the LCD */ delay_ms(5); LCD_Write_8_Bit( system_set_4_bit ); delay_ms(5); LCD_Write_8_Bit( system_set_4_bit ); delay_ms(5); LCD_Write_4_Bit( system_set_4_bit ); delay_ms(2); LCD_Write_4_Bit( display_off ); delay_ms(2); LCD_Write_4_Bit( clear_lcd ); delay_ms(2); LCD_Write_4_Bit( entry_mode ); delay_ms(2); LCD_Write_4_Bit( display_on ); delay_ms(2); LCD_Write_4_Bit( set_dd_ram ); delay_ms(2); LCD_DataMode(); end;procedure LCD_SetPos(pos: char);begin LCD_FunctionMode(); LCD_Write_4_Bit(pos); LCD_DataMode();end;procedure LCD_RShift;begin LCD_FunctionMode; LCD_Write_4_bit(00011100b); LCD_DataMode;end;procedure LCD_LShift;begin LCD_FunctionMode; LCD_Write_4_bit(00011000b); LCD_DataMode;end;procedure LCD_1stLine;begin LCD_FunctionMode(); LCD_Write_4_Bit(set_dd_line1); LCD_DataMode();end;procedure LCD_2ndLine;begin LCD_FunctionMode(); LCD_Write_4_Bit(set_dd_line2); LCD_DataMode();end;var b: char;begin//* First setup PIC Ports and Interrupts */ set_bit( STATUS, 'RP0' ); OPTION_REG := TxMode; // Set Option register. set_tris_a( 0x00); // Setup ports set_tris_b( 0x00); clear_bit( STATUS, 'RP0' ); output_low_port_a( LCD_SEL ); // Disable LCD disable_interrupt( 'GIE' ); // Enable Global Interrupts LCD_Setup;//* End of Setup */ LCD_1stLine; LCD_write_4_bit('D'); LCD_write_4_bit('i'); LCD_write_4_bit('g'); LCD_write_4_bit('i'); LCD_write_4_bit('t'); LCD_write_4_bit('a'); LCD_write_4_bit('l'); LCD_write_4_bit(' '); LCD_write_4_bit('G'); LCD_write_4_bit('r'); LCD_write_4_bit('a'); LCD_write_4_bit('F'); LCD_write_4_bit('i'); LCD_write_4_bit('X'); LCD_write_4_bit(' '); LCD_write_4_bit('G'); LCD_write_4_bit('r'); LCD_write_4_bit('u'); LCD_write_4_bit('p'); LCD_2ndLine; LCD_write_4_bit(' '); LCD_write_4_bit('0'); LCD_write_4_bit('2'); LCD_write_4_bit('5'); LCD_write_4_bit('1'); LCD_write_4_bit(' '); LCD_write_4_bit('/'); LCD_write_4_bit(' '); LCD_write_4_bit('4'); LCD_write_4_bit('1'); LCD_write_4_bit('3'); LCD_write_4_bit(' '); LCD_write_4_bit('5'); LCD_write_4_bit('6'); LCD_write_4_bit('2'); LCD_write_4_bit(' '); while (1) do begin delay_ms(250); delay_ms(250); LCD_LShift; delay_ms(200); delay_ms(100); LCD_LShift; delay_ms(200); delay_ms(100); LCD_LShift; delay_ms(250); delay_ms(250); LCD_RShift; delay_ms(200); delay_ms(100); LCD_RShift; delay_ms(200); delay_ms(100); LCD_RShift; end;end.

Link spre comentariu
Vizitator cosmin800

apropo de ccs c, functiile ccs high level sunt cam de tot kktu, de exemplu alea care lucreaza cu i2c busul nu au vrut sa mearga neam, a trebuit sa scriu (pardon sa iau de la altii) rutinele de start, stop write etc ...si chiar asa aia de la connex sunt cei mai mari hoti, au preturi cu dou trei sute de mii in plus fata de alte magazine cand vine vorba de picuri.

Link spre comentariu
  • 2 luni mai târziu...

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 cont

Autentificare

Ai deja un cont? Autentifică-te aici.

Autentifică-te acum



×
×
  • Creează nouă...

Informații Importante

Am plasat cookie-uri pe dispozitivul tău pentru a îmbunătății navigarea pe acest site. Poți modifica setările cookie, altfel considerăm că ești de acord să continui.Termeni de Utilizare si Ghidări