nut7546
Joined: 08 Sep 2010 Posts: 2
|
pic16f877 I want to change port of Keypad to portA or C |
Posted: Wed Sep 08, 2010 6:49 pm |
|
|
Hi All,
From below code.
I use ccs compiler.
Keypad is port B, LCD is portD.
I want to change port of Keypad is portA or C.
Please suggest to me too.
Thank you.
Code: |
#include <16F877A.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#include <lcd.c>
#define use_portb_kbd
#include <kbd.c>
int i=0;
char doc_id[8],pat_id[8];
void doctor();
void patiant();
void showid();
void kbd_pullup_init()
{
port_b_pullups(true);
}
void main()
{
char k;
int a=1;
kbd_pullup_init();
lcd_init();
doctor();
while (true)
{
lcd_putc("\fHELLO\n");
}
}
void doctor()
{
char k=0;
lcd_putc("\fID DOCTOR\n");
i=0;
while(i<4)
{
k=kbd_getc();
if(k!=0)
{
doc_id[i]=k;
lcd_putc(doc_id[i]);
i++;
}
}
patiant();
}
void patiant()
{
char k=0;
lcd_putc("\fPATIANT ID\n");
i=0;
while(i<4)
{
k=kbd_getc();
if(k!=0)
{
pat_id[i]=k;
lcd_putc(pat_id[i]);
i++;
}
}
showid();
}
void showid()
{
int j;
lcd_putc("\fDOC ID:");
for(j=0;j<4;j++)
{
lcd_putc(doc_id[j]);
}
lcd_putc("\n");
lcd_putc("PAT ID:");
for(j=0;j<4;j++)
{
lcd_putc(pat_id[j]);
}
delay_ms(2000);
} |
|
|