hello all,
i'm now testing the 4x4 keypad, but now i just do a simple program that just to on a led when i pressing a '1'
after troubleshooting, the code has no problem but the led could not blink..
here is my simple code:
#include <p18f4550.h>
#define row1 PORTBbits.RB7
#define row2 PORTBbits.RB6
#define row3 PORTBbits.RB5
#define row4 PORTBbits.RB4
#define col1 PORTBbits.RB3
#define col2 PORTBbits.RB2
#define col3 PORTBbits.RB1
#define col4 PORTBbits.RB0
void main()
{
TRISB=0xFF;
TRISD=0x00;
while (1){
int i;
int temp;
PORTB=0;
if (row1==1 & col1==1)
{
PORTDbits.RD7=1;
temp=200;
while(temp){
temp--;
}
i=1;
}
}
}
i had pull down 10k resistor to ground but it still cannot work.
please help.
i'm now testing the 4x4 keypad, but now i just do a simple program that just to on a led when i pressing a '1'
after troubleshooting, the code has no problem but the led could not blink..
here is my simple code:
#include <p18f4550.h>
#define row1 PORTBbits.RB7
#define row2 PORTBbits.RB6
#define row3 PORTBbits.RB5
#define row4 PORTBbits.RB4
#define col1 PORTBbits.RB3
#define col2 PORTBbits.RB2
#define col3 PORTBbits.RB1
#define col4 PORTBbits.RB0
void main()
{
TRISB=0xFF;
TRISD=0x00;
while (1){
int i;
int temp;
PORTB=0;
if (row1==1 & col1==1)
{
PORTDbits.RD7=1;
temp=200;
while(temp){
temp--;
}
i=1;
}
}
}
i had pull down 10k resistor to ground but it still cannot work.
please help.
Last edited: