Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/29/04 07:40
Read: times


 
Msg Score: 0
 -1 Gimmee Code
 +1 Underrated
#75074 - RE: LCD Problem.
Responding to: ???'s previous message
Hi Arif,
Try the below code.
Regards,
Charlie Bannister

$MOD51 
	;LCD Module testing programe 
	;D7 - D0 on P1 
	;RS on P3.0 
	;R/W on P3.1 
	;E on P3.2 
ORG 0000H 
	MOV A, #38H ;2 LINE, 5*7 CHAR 
	ACALL COMNWRT 
	ACALL DELAY 
	MOV A, #0EH ;Display ON, Cursor OFF 
	ACALL COMNWRT 
	ACALL DELAY 
	MOV A, #01H ;Cleasr display screen 
	ACALL COMNWRT 
	ACALL DELAY 

	MOV DPTR, #0FFFH
	mov r0, #0x08			;;======> set up 8 byte counter 
BACK: 	CLR A 
	MOVC A, @A+DPTR 
	JZ ENDD 
	ACALL DATAWRT 
	ACALL DELAY
	INC DPTR
	djnz r0, BACK			;;======>
 	MOV   A,#0C0h			;;======> 2nd line change address
 	ACALL COMNWRT                   ;;======>
	ACALL DELAY                     ;;======>
	SJMP BACK 
ENDD: 	SJMP ENDD 



COMNWRT: 
	MOV P1, A 
	CLR P3.0 ;RS = 0 
	NOP 
	NOP 
	CLR P3.1 ;R/W = 0 
	NOP 
	NOP 
	SETB P3.2 ;E = 1 
	NOP 
	NOP 
	CLR P3.2 ;E = 0 
	RET 


DATAWRT: 
	MOV P1, A 
	SETB P3.0 ;RS = 1 
	NOP 
	NOP 
	CLR P3.1 ;R/W = 0 
	NOP 
	NOP 
	SETB P3.2 ;E = 1 
	NOP 
	NOP 
	CLR P3.2 ;E = 0 
	RET 


DELAY: 	MOV R3, #50H 
HERE2: 	MOV R4, #255H 
HERE: 	DJNZ R4, HERE 
	DJNZ R3, HERE2 
	RET 

ORG 0FFFH 
	DB 'Testing LCD Work',0 
;	    ....x....x....x.
;	        5   10   15
;                   ^

END 





List of 10 messages in thread
TopicAuthorDate
LCD Problem.            01/01/70 00:00      
   RE: LCD Problem.            01/01/70 00:00      
      RE: LCD Problem.            01/01/70 00:00      
   RE: LCD Problem.            01/01/70 00:00      
      RE: LCD Problem.            01/01/70 00:00      
         LCD User`s Manual.            01/01/70 00:00      
            RE: LCD User`s Manual.            01/01/70 00:00      
   RE: LCD Problem.            01/01/70 00:00      
      Thanks Mr. Charles            01/01/70 00:00      
         Yes now my LCD module is working.            01/01/70 00:00      

Back to Subject List