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

Back to Subject List

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


 
#96578 - tutorial working ok
Responding to: ???'s previous message
hey mehdi

thanx for the reply, but when using the tutorial code there seems to be no problem





#include 8051.H


;-------Main routine----------------------------
	.org	0000H
	ajmp	Main

	.org	0100H
Main	LCALL	INIT_LCD
	LCALL	CLEAR_LCD
	MOV	A,	#'H'
	LCALL	WRITE_TEXT
	MOV	A,	#'E'
	LCALL	WRITE_TEXT
	MOV	A,	#'L'
	LCALL	WRITE_TEXT
	MOV	A,	#'L'
	LCALL	WRITE_TEXT
	MOV	A,	#'O'
	LCALL	WRITE_TEXT
	CLR	P2.2
	MOV	P0,	#0C4h
	SETB	P2.0
	CLR	P2.0
	LCALL	WAIT_LCD
	MOV 	A,	#'W'
	LCALL	WRITE_TEXT
	MOV	A,	#'O'
	LCALL	WRITE_TEXT
	MOV	A,	#'R'
	LCALL	WRITE_TEXT
	MOV	A,	#'L'
	LCALL	WRITE_TEXT
	MOV	A,	#'D'
	LCALL	WRITE_TEXT

	.end


;-------SUB routines--------------------------------



WAIT_LCD:
	CLR	P2.0		;Start LCD command
	CLR	P2.2		;It's a command
	SETB	P2.1		;It's a read command
	MOV	P0,	#0FFh	;Set all pins to FF initially
	SETB	P2.0		;Clock out command to LCD
	MOV	A,	P0	;Read the return value
	JB	ACC.7		,WAIT_LCD ;If bit 7 high, LCD still busy
	CLR	P2.0		;Finish the command
	CLR	P2.1		;Turn off RW for future commands
	RET

INIT_LCD:
	CLR	P2.2
	MOV	P0,	#38h
	SETB	P2.0
	CLR	P2.0
	LCALL	WAIT_LCD
	CLR	P2.2
	MOV	P0,	#0Eh
	SETB	P2.0
	CLR	P2.0
	LCALL	WAIT_LCD
	CLR	P2.2
	MOV	P0,	#06h
	SETB	P2.0
	CLR	P2.0
	LCALL	WAIT_LCD
	RET

CLEAR_LCD:
	CLR	P2.2
	MOV	P0,	#01h
	SETB	P2.0
	CLR	P2.0
	LCALL	WAIT_LCD
	RET

WRITE_TEXT:
	SETB	P2.2
	MOV	P0,	A
	SETB	P2.0
	CLR	P2.0
	LCALL	WAIT_LCD
	RET


so the what goes wrong, and where do the E's (046h)come from?
regards jeroen

List of 7 messages in thread
TopicAuthorDate
LCD producing E's            01/01/70 00:00      
   running off the end ?            01/01/70 00:00      
      Where can I get that LCD?            01/01/70 00:00      
   My opinion!            01/01/70 00:00      
      tutorial working ok            01/01/70 00:00      
   Problem solved            01/01/70 00:00      
      Another!            01/01/70 00:00      

Back to Subject List