In your first post you used...
INTCON2.7=1
But this actually DISABLE the internal pull-up...
Use
INTCON2.7=0
instead, and the problem will disapear
In your first post you used...
INTCON2.7=1
But this actually DISABLE the internal pull-up...
Use
INTCON2.7=0
instead, and the problem will disapear
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
i using pic18f4550 and PICBASIC PRO version 1.0 as my compiler..
while i compile my program below, there is warning which is
unable to include file keypad.bas
unable to include file lcd.bas..
this is my source code...
Code:'**************************************************************** '* Name : UNTITLED.BAS * '* Author : [select VIEW...EDITOR OPTIONS] * '* Notice : Copyright (c) 2010 [select VIEW...EDITOR OPTIONS] * '* : All Rights Reserved * '* Date : 10/5/2010 * '* Version : 1.0 * '* Notes : * '* : * '**************************************************************** Include "modedefs.bas" DEFINE PIC18F4550 DEFINE OSC 4 INCLUDE "KeyPad.bas" ' ( mister_e 's great keypad include file ) INCLUDE "lcd.bas" CMCON = 7 ADCON1 = 7 TRISD = %00000000 TRISB = %11111111 '// Declare Variables... Col_A VAR PORTB.0 Col_B VAR PORTB.1 Col_C VAR PORTB.2 Col_D VAR PORTB.3 Row_A VAR PORTB.4 Row_B VAR PORTB.5 Row_C VAR PORTB.6 Row_D VAR PORTB.7 Scan_Col VAR BYTE ' Counter - current col Key_Press VAR BYTE ' Value of key (0-9) & * + # + A + B + C + D Key_Down VAR BYTE ' Flag set true when key is depressed Allow_Key VAR BYTE ' Flag - disallow multiple keys being pressed I VAR byte ' General working var Scan_Keypad: @ incf _Scan_Col, 1 ' Inc col pos... SELECT CASE Scan_Col ' Col (1-4) CASE 1 Col_A = 0 ' Switch on col (active low) Col_B = 1 ' Col off Col_C = 1 ' Col off Col_D = 1 ' Col off '// 1 Key IF Row_A = 0 THEN ' Key down? ... IF Allow_Key = 0 THEN ' Any other key down? Key_Press = 1 ' Load var w/value of key Allow_Key = 1 ' Disallow other keys ENDIF ENDIF '// 4 Key IF Row_B = 0 THEN IF Allow_Key = 0 THEN Key_Press = 4 Allow_Key = 1 ENDIF ENDIF '// 7 Key IF Row_C = 0 THEN IF Allow_Key = 0 THEN Key_Press = 7 Allow_Key = 1 ENDIF ENDIF '// * Key IF Row_D = 0 THEN IF Allow_Key = 0 THEN Key_Press = 42 Allow_Key = 1 ENDIF ENDIF CASE 2 Col_A = 1 Col_B = 0 Col_C = 1 Col_D = 1 '// 2 Key IF Row_A = 0 THEN IF Allow_Key = 0 THEN Key_Press = 2 Allow_Key = 1 ENDIF ENDIF '// 5 Key IF Row_B = 0 THEN IF Allow_Key = 0 THEN Key_Press = 5 Allow_Key = 1 ENDIF ENDIF '// 8 Key IF Row_C = 0 THEN IF Allow_Key = 0 THEN Key_Press = 8 Allow_Key = 1 ENDIF ENDIF '// 0 Key IF Row_D = 0 THEN IF Allow_Key = 0 THEN Key_Press = 0 Allow_Key = 1 ENDIF ENDIF CASE 3 Col_A = 1 Col_B = 1 Col_C = 0 Col_D = 1 '// 3 Key IF Row_A = 0 THEN IF Allow_Key = 0 THEN Key_Press = 3 Allow_Key = 1 ENDIF ENDIF '// 6 Key IF Row_B = 0 THEN IF Allow_Key = 0 THEN Key_Press = 6 Allow_Key = 1 ENDIF ENDIF '// 9 Key IF Row_C = 0 THEN IF Allow_Key = 0 THEN Key_Press = 9 Allow_Key = 1 ENDIF ENDIF '// # Key IF Row_D = 0 THEN IF Allow_Key = 0 THEN Key_Press = 35 Allow_Key = 1 ENDIF ENDIF CASE 4 Col_A = 1 Col_B = 1 Col_C = 1 Col_D = 0 '// A Key IF Row_A = 0 THEN IF Allow_Key = 0 THEN Key_Press = 65 Allow_Key = 1 ENDIF ENDIF '// B Key IF Row_B = 0 THEN IF Allow_Key = 0 THEN Key_Press = 66 Allow_Key = 1 ENDIF ENDIF '// C Key IF Row_C = 0 THEN IF Allow_Key = 0 THEN Key_Press = 67 Allow_Key = 1 ENDIF ENDIF '// D Key IF Row_D = 0 THEN IF Allow_Key = 0 THEN Key_Press = 68 Allow_Key = 1 ENDIF ENDIF Scan_Col = 0 END SELECT LCDOUT $fe,1 LCDOUT " Key_Press " '// Check for key release, all cols on (active low) ... Col_A = 0 Col_B = 0 Col_C = 0 Col_D = 0 IF Row_A = 1 THEN IF Row_B = 1 THEN IF Row_C = 1 THEN IF Row_D = 1 THEN Allow_Key = 0 Key_Down = 0 Key_Press = 255 ENDIF ENDIF ENDIF ENDIF GOTO Scan_Keypad
please help me...
thank you...
Hi,
Do you have those two files, KeyPad.bas and lcd.bas in the same folder as your source file that you're trying to compile?
With that said, PBP1.0 sounds REALLY old, are you sure that is the cirrect version. And lastly, there's really no need to post the same question in three different threads, one would've been enough.
/Henrik.
Bookmarks