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.

security safe box with using PIC16f877a

Status
Not open for further replies.

emperror123

Member level 5
Member level 5
Joined
Dec 11, 2010
Messages
86
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,880
dear all

currently i am doing on program which is safe box by using PIC16F877a
i got the key pad program which i write it b myself

following are my code
Code:
list p = 16f877a
#include p16f877a.inc
__CONFIG _CP_OFF & _WDT_OFF & _XT_OSC & _PWRTE_ON

lcd_RS equ 1
lcd_write equ 0
lcd_op equ PORTD
kpad_pat equ 20
kpad_add equ 21
kpad_op equ 22
kpad_char equ 23

			org 00
			goto start
			org 04
			call interrupt

start 		bsf STATUS, RP0
			clrf TRISC
			clrf TRISD
			movlw B'11110000'
			movwf TRISB
			bcf OPTION_REG, NOT_RBPU ; enable internal power in PORTB
			bcf STATUS, RP0

; kaypad program
			clrf PORTB
			bcf INTCON, RBIF
			bsf INTCON, RBIE
			bsf INTCON, GIE
loop		goto loop

interrupt
kpad_to_lcd	call kpad_rd
			call kp_code_conv
			bsf PORTC, lcd_RS	;ques
			movwf lcd_op		;ques
			call lcd_write

rel_test	call kpad_rd
			movf kpad_pat, 0
			andlw 0xfe
			sublw 0xfe
			btfss STATUS, Z
			goto rel_test
			bcf INTCON, RBIF
			retfie

kpad_rd		movf PORTB, W
			movwf kpad_pat ;ques
			bsf STATUS, RP0
			movlw B'00001110'
			movwf TRISB
			bcf STATUS, RP0
			movlw 00
			movwf PORTB
			movf PORTB, W
			andlw B'00001110'
			iorwf kpad_pat, 1
			bsf STATUS, RP0
			movlw B'11110000'
			movwf TRISB
			bcf STATUS, RP0
			clrf PORTB
			return

kp_code_conv	bcf STATUS, C
				rrf kpad_pat, 1
				clrf kpad_add
				btfsc kpad_pat, 6
				goto kp1
				goto col_find

kp1			btfsc kpad_pat, 6
			goto kp2
			movlw B'00000100'
			iorwf kpad_add, 1
			goto col_find

kp2			btfsc kpad_pat, 4
			goto kp3
			movlw B'00001000'
			iorwf kpad_add, 1
			goto col_find

kp3			btfsc kpad_pat, 3
			goto kp4
			movlw B'00001100'
			iorwf kpad_add, 1
			goto col_find

kp4			movlw D'16'
			goto keypad_op

col_find	btfsc kpad_pat, 2
			goto cf1
			goto keypad_op

cf1			btfsc kpad_pat, 1
			goto cf2
			movlw B'00000001'
			iorwf kpad_add, 1
			goto keypad_op

cf2			movlw B'00000010'
			iorwf kpad_add, 1

keypad_op	movf kpad_add, 0
			call kp_table
			movwf kpad_char
			return

kp_table	addwf PCL, 1
			retlw '1'
			retlw '2'
			retlw '3'
			retlw 'A'
			retlw '4'
			retlw '5'
			retlw '6'
			retlw 'B'
			retlw '7'
			retlw '8'
			retlw '9'
			retlw 'C'
			retlw '*'
			retlw '0'
			retlw '#'
			retlw 'D'
			retlw 'E'

end

since i got it, but i now confused how to put the coding for LCD display code and servo motor code in my code, since i have cracked my head for many days still remain unsolve

2nd is i wan to have a schematic diagram for safe box which is consist of PIC16f877a, servo motor, keypad and LCD display
a lot of article draw with seperately, and i unable to use which 1 to do it,

thank, and ur help is much appreciated
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top