Sari la conținut
ELFORUM - Forumul electronistilor

LCD-Display LCM1602ASL 16x2 Problema


pspsuceava

Postări Recomandate

deci montajul era bine facut dar nu stiu de ce nu mergea cu 9v de la baterie + stabilizator, daca pun direct cum mi-a recomandat cel caruia ii multumesc foarte mutl un incarcator de telefon functioneaza bine mersi , cred ca si celalalt merge foarte bine , dar momentan sunt pe " obsedat " sa ma " joc " cu asta ca sa am timp sa il verific si pe ala !Oricum va multumesc foarte mult si cred ca ar trebui sa stie d eproblema asta si restul forumistilor!Si inca ceva pentru cei are ziceau ca nu merge sa il aprinzi fara un microcontroller - FALS , merge dupa schema postata de colegul de mai sus :) !

Link spre comentariu
  • Răspunsuri 148
  • Creat
  • Ultimul Răspuns

Top autori în acest subiect

  • pspsuceava

    35

  • Liviu M

    22

  • pegas

    14

  • MatyC

    12

Top autori în acest subiect

Imagini postate

Felicitari, daia am mai si postat o data sa incerci acea schema nu avea cum sa nu apara nimic pe lcd...Alta data sa iei baterii de 9v originale nu non-name... eu iau numai varta de ex pentru aparat de masura care este sigilat intr-un ambalaj cu carton si plastic nu o simpla tipla si ma tine cam 2 ani una :nebunrau: pe cand daca iau una la 2lei nici o luna nu tine :sparge: CHINABafta!

Link spre comentariu

Da ma rog. Eu nu am incercat niciodata sa pierd timpul doar pentru un clipici pe display. De asta nu am contrazis de mai demult varianta fara procesor. Am observat de la bun inceput ca ai breadboard si nu intzeleg cum de la max 15 min pentru testare ai ajuns la atata timp? Ce ai gresit in schema aia cand ai implementat-o pe breadboard?

Link spre comentariu

Nu era nicio greseala !! :) Doar ca bateria era prea descarcata ... .Astazi ma apuc de programat ca ieri nu am avut timp . Sa vad daca reusesc ceva , inca ceva , am pus programul ala si nu merge , cel care l-am postat pe aici intr-un link cel de aici , deci programul e bun dar nu afiseaza nimic , raman tot patratele " clasice " .Trebuie pusi pinii liber ( cei 4 ) la - ca sa mearga :) ?

Link spre comentariu

Asta e programul :

PROCESSOR 16f84a#include "p16f84a.inc"__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC;Variabile	cblock 0x0C	HIcnt	L0cnt	L00Pcnt	LCDbuf	LCDtemp	Digtemp	Dig1	Dig2	Dig3	temp	endc	ORG 0x00	goto Main	ORG 0x04	goto Main	include "mikroel84.inc"	include "LCDMACRO.inc"	LCDdsport equ PORTB	RS equ 1	RW equ 2	EN equ 3Main 	movlw .23	movwf temp	lcdinitLoop	lcdcmd 0x01	lcdtext 1,"mikroelektronica"	lcdtext 2,"Proba LCD"	pausems .2000	lcdcmd 0x01	lcdtext 1,"Temperatura"	lcdtext 2,"temp="	lcdbyte temp	lcdtext 0,"C"	pausems .2000	goto Loop;Sfarsit	END
Asta e macro-ul copiat de mine de pe o " poza " :

 

 

CONSTANT FUNCTSET8=b'00110000'CONSTANT FUNCTSET4=b'00100000'CONSTANT DDZERO=b'10000000'CONSTANT LCD2L=b'00101000'CONSTANT LCDCONT=b'00001100'CONSTANT LCDSH=b'00101000';Commands for working with LCD displayCONSTANT LCDCLR=b'00000001'CONSTANT LCDCH=b'00000010'CONSTANT LCDCL=b'00000100'CONSTANT LCDCR=b'00000110'CONSTANT LCDSL=b'00011000'CONSTANT LCDSR=b'00011100'CONSTANT LCDL1=b'10000000'CONSTANT LCDL2=b'11000000'lcdinit macro	bank1	clrf LCDdsport	bank0		call Delay1ms	call Delay1ms	call Delay1ms	call Delay1ms	movlw FUNCTSET8	call SendW	call Delay1ms	call Delay1ms	movlw DDZERO	call SendW	movlw FUNCTSET4	call SendW	lcdcmd LCD2L	lcdcmd LCDCONT	lcdcmd LCDSH	lcdcmd LCDCLR	endm	lcdcmd  macro LCDcommand		movlw LCDcommand		call LCDcomd		endm	lcdclr  macro		movlw LCDCLR		call LCdcomd		endmLCD_DDAdr macro DDRamAddressLocal   value=DDRamAdress | 0x80	movlw value	call LCDcomd	endmLCDcomd clrf LCDbuf	goto LCDwrLCDdata clrf LCDbuf	bsf LCDbuf,RSLCDwr   movwf LCDtemp	andlw b'11110000'	iorwf LCDbuf,w	call SendW	swapf LCDtemp,w	andlw b'11110000'	iorwf LCDbuf,w	call SendW	returnSendW	clrf	LCDdsport	movwf	LCDdsport	call	Delay1ms	BSF	LCDdsport,EN	bcf	LCDdsport,EN	call	Delay1ms	clrf	LCDdsport	returnlcdtext macro select, textlocal Messagelocal Startlocal Exitlocal i=0	goto StartPoruka dt text	dt 0Start	if select==1	lcdcmd LCDL1	else	if select==2	lcdcmd LCDL2	endif	endifwhile i<16	call Message+i	addlw 0	bz Exit	call LCDdata	i=i+1endwExitendmlcdbyte macro arg0	digbyte arg0		movf Digl,w	btfsc STATUS,Z	movlw 0xf0	addlw 0x30	call LCDdata	movf Dig2,w	btfsc STATUS,Z	movlw 0xf0	addlw 0x30	call LCDdata	movf Dig3,w	addlw 0x30	call LCDdataendmDelay1ms:	movlw .100	movwf L00PcntDelay10us:	nop	nop	nop	nop	nop	nop	nop	decfsz L00Pcnt,f	goto Delay10us	return
Nelamurirea mea este ca acolo cere un fisier numit mikroel84.inc , un header , dar pe care nu il gasesc si nici nu am idee cu ce se ocupa .

 

Daca aveti alt Macro pentru LCD care nu il foloseste sau care l-ati folosit si e mai bun , multumesc mult :)!

 

Eu am gasit un mikroel84 insa nu merge si de asta as prefera un alt macro inafara de asta .

 

;***************************************************************************;                                                                     ;       Memory select macros for PIC 16XXXX;       ==================================;;***************************************************************************bank0   macro        bcf     STATUS,RP0        endmbank1   macro        bsf     STATUS,RP0        endm;***************************************************************************;                                                                     ;      ;       ==================================;;***************************************************************************digbyte macro arg0	local Pon0	local Exit1	local Exit2	local Pozitiv	clrf Dig1	clrf Dig2	clrf Dig3Pozitiv		movf arg0,w	movwf Digtemp	movlw .100Pon0		incf Dig1,f	subwf Digtemp,f	btfsc STATUS,C	goto Pon0	decf Dig1,f	addwf Digtemp,fExit1	movlw .10	incf Dig2,f	subwf Digtemp,f	btfsc STATUS,C	goto Exit1	decf Dig2,f	addwf Digtemp,fExit2	movf Digtemp,w	movwf Dig3	endm;***************************************************************************;                                                                     ;      ;       ==================================;;***************************************************************************pausems macro arg1local Loop1local dechilocal Delay1mslocal Loop2local Kraj	ifndef OSC	#define OSC 4	endif 	movlw high (arg1*OSC/4)	movwf HIcnt	movlw low (arg1*OSC/4)	movwf LOcntLoop1	movf LOcnt,f	btfsc STATUS,Z	goto dechi		call Delay1ms	decf LOcnt,f	goto Loop1	dechi	movf HIcnt,f	btfsc STATUS,Z	goto Kraj	call Delay1ms	decf HIcnt,f	decf LOcnt,f	goto  Loop1		Delay1ms:	movlw .100	movwf LOOPcntLoop2:	nop			nop 	nop	nop		nop 	nop	nop		decfsz LOOPcnt,f	goto Loop2	returnKrajendm;***************************************************************************;                                                                     ;      ;       ==================================;;***************************************************************************push macro	movwf Wtempendm
Link spre comentariu

list	p=PIC16F84A		include 	<P16F84A.INC>;*******************************************;	4 BIT LCD interface with PIC	;	only port B is implemented;	RB7-RB4 = DB7-DB4  ; RB3=E ; RB2=RW ; RB1=RS;*******************************************		;declerationBIT_E	EQU		3BIT_RW	EQU		2BIT_RS	EQU		1TEMP	EQU	0x020	;TEMP STORAGEV_DLY	EQU	0x021           ; Variable for DLYV_DLY1	EQU	0x022           ; for DLY1		org 0h ;start of program at		goto	START		;initialiseINITPIC		bsf		STATUS,RP0 ;sellect bank 1		movlw	b'00000000'		movwf	TRISB	;set as output		bcf 	STATUS,RP0 ;select bank 0		clrf	PORTB			return		INITLCD			;INITIALIZE LCD		MOVLW	0xFE		;WAIT LONG		CALL	DLY1		;254 * 0.5 = DELAY OF 127ms 											;BUSY FLAG CAN'T BE CHECKED RIGHT NOW					MOVLW	B'00111000'	;FUNCTION SET - 8 BIT, BIT_E = HIGH		MOVWF	PORTB		BCF		PORTB,BIT_E	; BIT_E = LOW				MOVLW	0x0A			;wait for about 5ms		CALL	DLY1 				MOVLW	B'00111000'	;FUNCTION SET - 8 BIT, BIT_E=HIGH		MOVWF	PORTB		BCF		PORTB,BIT_E		MOVLW	0x02			;		CALL	DLY1 				MOVLW	B'00111000'	;FUNCTION SET - 8 BIT, BIT_E = high		MOVWF	PORTB		BCF		PORTB,BIT_E	;BIT_E=LOW					;above i have done same command 3 times, this may be not necessary, i just followed datasheet							CALL	LCDBUSY		;BUSY FLAG CAN BE CHECKED NOW!		MOVLW	B'00101000'	;FUNCTION SET - 4 BIT ,BIT_E = HIGH		MOVWF	PORTB		BCF		PORTB,BIT_E							;..........EVERY INSTRUCTION WILL BE OF 2 CYCLE FROM HERE		CALL	LCDBUSY		;..FUNCTION SET..		MOVLW	B'00101000'		MOVWF	PORTB		BCF		PORTB,BIT_E	;1 CYCLE COMPLETE		MOVLW	B'10001000'		MOVWF	PORTB		BCF		PORTB,BIT_E	;2 CYCLE				CALL	LCDBUSY		;DISPLAY CONTROL - 		MOVLW	B'00001000'	; 1ST NIBBLE AND BIT_E=1,BIT_RW=0,BIT_RS=0		MOVWF	PORTB		BCF		PORTB,BIT_E	;1 CYCLY		MOVLW	B'11111000'	;DISPLAY CONTROL NIBBLE (DISP=ON,CURSOR=ON,BLINK=ON) AND BIT_E=1,BIT_RW=0,BIT_RS=0		MOVWF	PORTB		BCF		PORTB,BIT_E	;2 CYCLE				CALL	LCDBUSY		;CLEAR DISPLAY AND HOME CURSOR		MOVLW	B'00001000'		MOVWF	PORTB		BCF		PORTB,BIT_E		MOVLW	B'00011000'		MOVWF	PORTB		BCF		PORTB,BIT_E				CALL	LCDBUSY		;ENTRY SET - 		MOVLW	B'00001000'	; BIT_E=1,BIT_RW=0,BIT_RS=0		MOVWF	PORTB		BCF		PORTB,BIT_E	;1 CYCLE		MOVLW	B'01101000'	;ENTRY SET - INCREMENT,NO DISP SHIFT(CUR SHIFT),BIT_E=1,BIT_RW=0,BIT_RS=0		MOVWF	PORTB		BCF		PORTB,BIT_E	;2 CYCLE				RETURN		LCDBUSY		BSF		STATUS,RP0	;SELLECT BANK 1		MOVLW	B'11110000'		MOVWF	TRISB		;SET RB7-RB4 INPUT		BCF		STATUS,RP0	;SELLECT BANK 0				BSF		PORTB,BIT_RW		BCF		PORTB,BIT_RS				BSF		PORTB,BIT_E		MOVF	PORTB,W		;READ		BCF		PORTB,BIT_E	;1 CYCLE complete		BSF		PORTB,BIT_RW		BCF		PORTB,BIT_RS		BSF		PORTB,BIT_E		NOP					;DO NOTTHING COZ BUSY FLAG IS IN FIRST NIBBLE		BCF		PORTB,BIT_E	;2nd CYCLE complete				ANDLW	0x80		BTFSS	STATUS,Z	;CHECK BUSY		GOTO	LCDBUSY		;LOOP IF BUSY				BCF		PORTB,BIT_RW		;**		BSF		STATUS,RP0		;NOT BUSY SO MAKE PORT B O/P		MOVLW	0x000		MOVWF	TRISB		BCF		STATUS,RP0				RETURN		;LCD COMMANDS--- i have written routines for only 2 basic commands,				; one has to write routines for shifting display/crussor, home crussor etc.				;it's easy just follow datasheet and i'll include it someday!				LINE2		;by selecting DDRAM address = 0x40 in case of 16x4 line LCD, see datasheet of HD44780		MOVLW	B'11001000'		MOVWF	PORTB		BCF		PORTB,BIT_E		MOVLW	B'00001000'		MOVWF	PORTB		BCF		PORTB,BIT_E		RETURN		LCDWRITE		;Writes data/character in W register to sellected CG/DD RAM, see its use in START routine		MOVWF	TEMP		CALL	LCDBUSY		MOVF	TEMP,W		ANDLW	B'11110000'		IORLW	B'00001010'	;BIT_E=1,BIT_RW=0,BIT_RS=1		MOVWF	PORTB		BCF		PORTB,BIT_E	;1 CYCLE COMPLETE		SWAPF	TEMP,W		;SWAP NIBBLES AND STORE IN W REGISTER		ANDLW	B'11110000'		IORLW	B'00001010'	;BIT_E=1,BIT_RW=0,BIT_RS=1		MOVWF	PORTB		BCF		PORTB,BIT_E	;2 CYCLE COMPLETE				RETURN;Delay routines		;500uS delay with 4MHzDLY    	MOVLW	D'165'                  	MOVWF	V_DLY               DLY_LOOP    	DECFSZ	V_DLY, F               	GOTO	DLY_LOOP          	RETURN                     ; w times DLYDLY1    	MOVWF	V_DLY1            DLY1_LOOP    	CALL	DLY               	DECFSZ	V_DLY1, F             	GOTO	DLY1_LOOP         	RETURN                      START		CALL	INITPIC		;initialize PIC		CALL	INITLCD		;initialize LCD								MOVLW	D'72'		;H	;Write to DDRAM which is displayed in LCD, DDRAM already sellected at initialization		CALL	LCDWRITE					MOVLW	D'69'		;E		CALL	LCDWRITE				MOVLW	D'76'		;L		CALL	LCDWRITE				MOVLW	D'76'		;L		CALL	LCDWRITE				MOVLW	D'79'		;O		CALL	LCDWRITE				MOVLW	D'32'		; 0x20 space		CALL	LCDWRITE				MOVLW	D'87'		;W		CALL	LCDWRITE				MOVLW	D'79'		;O		CALL	LCDWRITE				MOVLW	D'82'		;R		CALL	LCDWRITE				MOVLW	D'76'		;L		CALL	LCDWRITE		MOVLW	D'68'		;D		CALL	LCDWRITE		MOVLW	D'33'		;!		CALL	LCDWRITE						CALL	LINE2		;set crussor to line 2		MOVLW	D'76'		;L		CALL	LCDWRITE		MOVLW	D'73'		;I		CALL	LCDWRITE		MOVLW	D'78'		;N		CALL	LCDWRITE		MOVLW	D'69'		;E		CALL	LCDWRITE		MOVLW	D'32'		;space		CALL	LCDWRITE		MOVLW	D'50'		;2		CALL	LCDWRITE		LOOP	NOP				GOTO	LOOP	;endless loop				END

Am gasit ce cautam acuma sa vad daca si functioneaza.

Link spre comentariu

Incearca sa faci ledul ala din poze sa palpaie comandat de pic, ca sa vezi daca picul functioneaza sau e intepenit pe undeva (un cod simplu inserat printre comenzile pentru LCD).

Link spre comentariu

Incearca sa faci ledul ala din poze sa palpaie comandat de pic, ca sa vezi daca picul functioneaza sau e intepenit pe undeva (un cod simplu inserat printre comenzile pentru LCD).

Am facut asta chiar inainte de a posta ultimul posta azi :) !Si merge , ca ma gandeam ca e o problema ca nu mai folosesc 7805 , dar nu e vorba de asta .
Link spre comentariu
Vizitator Kuky

Am atasat o versiune care afiseaza pe 2 randuri ceva.Programul merge, e testat de mine pe un LCD 2 x 16 controlat de PIC16F84APoate te ajuta in vreun fel ... mai trebuie sa ii adaugi rutine daca vrei sa iti afiseze un sir de caractere ceva gen "LCDtext macro select,text "cum aveai tu in programul tau de mai sus. Momentan stie doar LCDchar 'litera'.LCD-ul este legat identic cum ai tu ,totusi verifica pinii D4-D7 de la LCD sa fie legati la RB4-RB7 iar RB1 cu RS, RB2 cu R/W, RB3 cu E.Mentionez ca eu lucrez in MPLAB IDE v8.66 Spor la treaba !

Link spre comentariu

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