khai13
Newbie level 4
Hi
i have a problem i hope you could help me.
im interfacing a 4x4 keypad with an lcd for password detection
my pic16f877a pic have a infinite loop while waiting for an input
causing my i/o port's output voltage to be only 0.7V
can u tell me how to solve the output voltage problem, its at PORTD
*call keypad_data is a routine that returns 0 when what_button is d'16'
following code:
i have a problem i hope you could help me.
im interfacing a 4x4 keypad with an lcd for password detection
my pic16f877a pic have a infinite loop while waiting for an input
causing my i/o port's output voltage to be only 0.7V
can u tell me how to solve the output voltage problem, its at PORTD
*call keypad_data is a routine that returns 0 when what_button is d'16'
following code:
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 begin call scan_keypad ;if no input pressed, w= 16, what_button=16 call keypad_data ;if w=16, return w=0 xorlw 00H ;if w=0 , status Z become 1 btfsc status,z ;if Z=1, no button pressed keep looping goto begin scan_keypad ;subroutine movf what_button,w bsf PORTD,0 ;scan first column of keys btfsc PORTC,2 ;has the * key been pressed? if yes then movlw d'14' ; copy *(14) into w , not then skip btfsc PORTC,3 ;has the 7 key been pressed? if yes then movlw d'07' ; copy 7 into w , not then skip btfsc PORTC,4 ;has the 4 key been pressed? if yes then movlw d'04' ; copy 4 into w , not then skip btfsc PORTC,5 ;has the 1 key been pressed? if yes then movlw d'01' ; copy 1 into w , not then skip bcf PORTD,0 ;finished scanning first column ... if no keypad is pressed movlw d'16' movf what_button,w return
Last edited by a moderator: