LCD Using pic16f628a

Find out how to setup your programmer's software and how to solve many common problems.

Moderator: phalanx

Post Reply
Knightmare
Posts: 1
Joined: Sat May 31, 2014 7:54 am

LCD Using pic16f628a

Post by Knightmare » Sat May 31, 2014 8:06 am

This code count from 0 to 9 by a ( count up sensor ) and from 9 to 0 by a( count down sensor ).
but it go more than 9 and less than 0 when the sensors work showing some symbols and letters
i want to improve it and make when it reach 9 and the count up sensor work it ignore it and stay on 9
and the same with the 0 when it reach 0 and the count down sensor work it ignore it and stay on 0

Code: Select all

include<p16f628a.inc>
	CBLOCK	H'20'
	COUNT1	
	COUNT2	
	COUNT3
	LCD_POINTER
	LAB_COUNT
	New
	endc	
#define	LCD_RS	PORTA,0
#define	LCD_RW	PORTA,1
#define	LCD_E	PORTA,2
#define	IN_	PORTA,3
#define	OUT_	PORTA,4
#define	Nothing	PORTB,6	
	clrf	PORTA
	clrf	PORTB
	clrf	COUNT1
	clrf	LAB_COUNT
	
	movlw	H'07'
	movwf	CMCON
	bsf	STATUS,RP0	
	movlw	b'11111000'
	movwf	TRISA
	movlw	b'00000000'
	movwf	TRISB
	bcf	STATUS,RP0
	call	Delay_L
	
	movlw	b'00001100'
	call	Send_CMD	
	movlw	b'00111000'
	call	Send_CMD	

	call	Text1
	call	Disp_C

Start
	btfsc	IN_
	goto	INC_LAB	
	btfsc	OUT_
	goto	DEC_LAB	
	goto	Start
	
INC_LAB
	incf	LAB_COUNT,f
	call	Disp_C
	goto	Start



DEC_LAB
	decf 	LAB_COUNT,f
	call	 Disp_C
	goto 	Start



Disp_C	movlw	b'10000100'
	call	Send_CMD
	call	Delay_L	
	movf	LAB_COUNT,w
	iorlw	H'30'
	call	Send_CHR
	return



Text1
	clrf	LCD_POINTER
Text1L	movf	LCD_POINTER,w
	call	TextM1
	call	Send_CHR
	incf	LCD_POINTER,w
	xorlw	d'4'
	btfsc	STATUS,Z
	return
	incf	LCD_POINTER,f
	goto	Text1L	







Puls_E
	bsf	LCD_E
	nop
	bcf	LCD_E
	return	
Send_CMD
	bcf	LCD_RS
	bcf	LCD_RW
	movwf	PORTB
	call	Puls_E
	call	Delay_S
	return
Send_CHR
	bsf	LCD_RS
	bcf	LCD_RW
	movwf	PORTB
	call	Puls_E
	call	Delay_S
	return

Delay_S
Loop1	deCfsz	COUNT1,f
	goto	Loop1 
	return

Delay_L
Loop2	call	Delay_S
	deCfsz	COUNT2,f
	goto	Loop2 
	return


TextM1
	addwf	PCL,f
	dt	"LAB:",0


	end



please dont tell me what should i do to fix it because am not good at programming
just fix it please

thank you for your time

waltr
Support Volunteer
Posts: 2823
Joined: Tue Sep 08, 2009 12:07 pm
Location: Philadelphia, USA

Re: LCD Using pic16f628a

Post by waltr » Mon Jun 02, 2014 7:40 am

please dont tell me what should i do to fix it because am not good at programming
just fix it please
Sorry we don't do that since you will never learn anything and that is the point of SparkFun and this forum.
Last edited by waltr on Tue Jun 03, 2014 5:43 am, edited 1 time in total.

skimask
Support Volunteer
Posts: 1244
Joined: Sun Nov 09, 2008 2:11 am
Location: Minot, N.D.

Re: LCD Using pic16f628a

Post by skimask » Mon Jun 02, 2014 11:12 pm

Knightmare wrote:please dont tell me what should i do to fix it because am not good at programming
just fix it please
:o :shock: :mrgreen: :violin: :violin: :violin: :clap: :mrgreen: :mrgreen: :mrgreen: :D :roll: :roll: :o :violin: :violin: :violin: :violin: :whistle: :whistle: :whistle: :whistle:
I ignore "one post wonders".

Post Reply