Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

[SOLVED] Pic16f877a driving 16X04(Samsung KS0066)-Assembly-

Status
Not open for further replies.
thank you wp100
i didn't get to debbugging yet, i'm gonna do it after my dinner :). Meanwhile here's my code
Code:
;============================================================
; File name:
; Date:
; Author:
; Processor:
; Reference circuit:
;============================================================
; Copyright notice:
;============================================================
; Program Description:
;
;===========================
; configuration switches
;===========================
list		p=16f877A	; list directive to define processor
	#include	<p16f877A.inc>	; processor specific variable definitions
	
	__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF


;=====================================================
; constant definitions
;=====================================================
;=====================================================
; PIC register equates
pcl  EQU 2
;=====================================================
;=====================================================
; variables in PIC RAM
;=====================================================
cblock 0x20
counter1 :  1 
counter2  : 1
number   : 1
endc
;============================================================
; program
;============================================================
org 0X00 ; start at address
goto main
; Space for interrupt handlers
org 0x08


delay
	movlw	0x1a
	movwf	counter2
loop1
	movlw	0xff
	movwf	counter1
loop2
 	nop
	decfsz counter1
	goto loop2
	decfsz counter2
	goto loop1
return

instw  
	movwf	PORTB
	call delay
	bcf	PORTD,4
	call delay
	bsf	PORTD,5
	call delay
	bcf	PORTD,5
	call	delay
return
dataw 
	movwf PORTB
	call delay
	bsf PORTD, 4
	call delay
	bsf PORTD, 5
	call delay
	bcf PORTD, 5 ;Transitional E signal
	call delay
return

main:
	bsf STATUS,RP0
	movlw	0x00
	movwf	TRISB
	movwf	TRISD
	bcf STATUS,RP0
	clrf	PORTD
	clrf	PORTB
	call delay
	call delay
start
	clrf PORTD ;Here RW is pulled down to ground
;LCD routine starts
	call delay
;give LCD module to reset automatically
;Fundtion for 8-bit, 2-line display, and 5x8 dot matrix

	
	movlw 0x38
	call instw
	call delay
	movlw 0x0E
	call instw
	call delay
	movlw 0x01
	call instw
	call delay
	movlw 0x48
	call dataw
	movlw 0x45
	call dataw 
	movlw 0x4c
	call dataw
	movlw 0x4c
	call dataw
	movlw 0x4f
	call dataw 
	movlw 0x20
	call dataw 
	movlw 0x57
	call dataw
	movlw 0x4f
	call dataw 
	movlw 0x52
	call dataw
	movlw 0x4c
	call dataw
	movlw 0x44
	call dataw

		
;============================================================
end ; END OF PROGRAM
;============================================================
 
Last edited:

Hi
I figure out the problem.I made a little loop after the last instruction.everything is ok now. Thank you all for your help especially wp100.
 

Yes. If you have a goto main then it will loop in the main function and the lcd initialization and other code is looped and hence looping occurs. If you place an infinite loop after the lcd initialization then then lcd initialization is not looped. It is similar to a C code which prints something on LCD in the main() function and then enters a empty while(1) loop.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top