Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Help me fix my Assembly code for display 'A' on 16x2 LCD

Status
Not open for further replies.

smiles

Advanced Member level 4
Joined
Jul 27, 2007
Messages
110
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
2,096
hi ! I am quite new to assembly coding (using Pic16F877)
here is my program for display 'A' character on LCD screen and it wrong (simulate using Proteus)
Code:
	list		p=16f877a	; list directive to define processor
	#include	<p16f877a.inc>	; processor specific variable definitions
	__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _RC_OSC & _WRT_OFF & _LVP_ON & _CPD_OFF
;*******************************************************************
	org		0x0000
	goto 	Main
	org		0x0005	
Main
	banksel	TRISB
	movlw	00h
	movwf	TRISB		;Set all PORTB pins to output
	banksel	TRISA	
	bsf		ADCON1,1	;Port A is digital I/O 
	bsf		ADCON1,2	;...
	movlw	01h
	movwf	TRISA		;pin 0 is input, the rest is output
	banksel	PORTA
Main1
	clrf	PORTB		
	bsf		PORTA,2		;RS pin on
	bsf		PORTA,4		;E pin on
	bcf		PORTA,3		;R/W pin off
;	banksel	PORTB
	movlw	41h
	movwf	PORTB		;"A" character
	bcf		PORTA,4		;E pin off
	bcf		PORTA,2		;RS pin off
	bsf		PORTA,3		;R/W pin on
	goto	Main1
	END
Here is the diagram
and the write process diagram of LCD (LM018L) is here
http://img2.freeimagehosting.net/uploads/3d2122c70f.jpg
Could you tell me what wrong with my code, thanks so much !
 

Turbokeu

Junior Member level 1
Joined
Apr 25, 2005
Messages
16
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,281
Activity points
1,426
16x2lcd+test+program

RA4 port is on most PICs (if not all) of open collector type. This means you need a pullup resistor (ex. 10K) to +5V.
Also I don't like the way you connect your push button to a port. Here also you should use a pullup or pulldown resistor and act accordingly in software.

See also here:


CD :)
 

smiles

Advanced Member level 4
Joined
Jul 27, 2007
Messages
110
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
2,096
lcd character display 16x2

Thanks, but I just do simply with my test program, seem that you very familiar with Proteus, do you know the meaning of yellow signal at pins when simulating ?
Thanks !!!
 

Turbokeu

Junior Member level 1
Joined
Apr 25, 2005
Messages
16
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,281
Activity points
1,426
proteus 16x2 lcd test

Never had a 'yellow signal' with Proteus but I suppose this is an undefined level: not '0' (GND) and not '1' (+5V).

Put the pullup/pulldown resistors as I advised.

CD :)
 

smiles

Advanced Member level 4
Joined
Jul 27, 2007
Messages
110
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
2,096
Re: 'A' on 16x2 LCD

I had followed your advice !!!
Thanks !!! :)
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top