hello i m doing a proj on lc60 that requires me to do a programme on keyboard interrupt. i keep getting errors on my codes. Can anyone point out my mistake? Thank you.
#include <MC9S08LC60.h>
#include "derivative.h"
#include <stdtypes.h>
#include "LCD.h"
#include "TPM1.h"
#include <stdio.h>
#include "Delays.h"
//#include "StopModes.h"
//#include "Timeout.h"
//#include "ADC.h"
#include "KBInotes.h"
unsigned char ucKey_press, ucKey_press2,row_press, column_press, i=1, P_ucKey_press;
unsigned char KeyStore[6]={0,0,0,0,0,0}; //Test
unsigned char *str, key_entered= FALSE;
// KEYPAD
/////////////////////////////////////////////////////////////////////////////////////////
void KBIinit (void){
KBI1SC_KBIE = 0; //clear keyboard interrupt
KBI1ES = 0; //select falling edge
PTADD = 0X78; //initialize Port A(0,1,2) as inputs, Port A(3,4,5,6) as output
PTAPE = 0X07; //Pull up enable for bit 0,1,2
KBI1PE = 0X07; //Enables pin 0-2
KBI1SC_KBACK = 1; //Clear interrupt
KBI1SC_KBIE = 1; //Keyboard interrupt enabled
PTAD=0x00; // set other output to low
KBI1SC_KBIMOD = 0; //Keyboard detects edges only
}
void Column_Read(void)
{
if (PTAD_PTAD0 == 0)
{
column_press = 1;
}
else if (PTAD_PTAD1 == 0)
{
column_press = 2;
}
else if (PTAD_PTAD2 == 0)
{
column_press = 3;
}
}
void Row_Read(void)
{
PTADD = 0X07; //initialize Port A(3,4,5,6) as inputs, Port A(0,1,2) as output
PTAPE = 0X78; //Pull up enable for bit 3,4,5,6
KBI1PE = 0X78; //Enables pin 3-6
PTAD_PTAD4 = 1;
PTAD_PTAD0 = 0;
PTAD_PTAD1 = 0;
PTAD_PTAD2 = 0;
if (PTAD_PTAD3 == 0)
{
row_press = 1;
}
else if (PTAD_PTAD3 == 1)
{
row_press = 0;
}
PTADD = 0X78; //initialize Port A(0,1,2) as inputs, Port A(3,4,5,6) as output
PTAPE = 0X07; //Pull up enable for bit 0,1,2
KBI1PE = 0X07; //Enables pin 0-2
PTAD_PTAD3 = 0;
PTAD_PTAD4= 0;
PTAD_PTAD5= 0;
PTAD_PTAD6=0;
}
void KBI_Read (void)
{
//declaration of 2 dimensional array
static char KBI_Read_Data[3] = {{'1'},{'2'},{'3'}};
Column_Read();
Row_Read();
ucKey_press = KBI_Read_Data[column_press - 1];
key_entered= TRUE;
}
unsigned char KBI_Read2(void){ //for passing back to BMI prog as unsigned char fn.
key_entered = FALSE;
while (!key_entered);
ucKey_press2=ucKey_press;
key_entered = FALSE;
return ucKey_press2;
}
void Keypad_Recall_Display(void)
{
//declaration
unsigned char First_Digit=0, Second_Digit=0, Third_Digit=0;
unsigned char Fourth_Digit=0, Fifth_Digit=0, Sixth_Digit=0;
First_Digit = KeyStore[0];
Second_Digit = KeyStore[1];
Third_Digit = KeyStore[2];
Fourth_Digit = KeyStore[3];
Fifth_Digit = KeyStore[4];
Sixth_Digit = KeyStore[5];
LCDPutChar(First_Digit, 1);
LCDPutChar(Second_Digit, 2);
LCDPutChar(Third_Digit, 3);
LCDPutChar(Fourth_Digit, 4);
LCDPutChar(Fifth_Digit, 5);
LCDPutChar(Sixth_Digit, 6);
}
//======================Keypad interrupt=========================
interrupt VectorNumber_Vkeyboard1 void KeypadInterrupt (void){
extern unsigned int TimerTable[10], TimerFlag[10];
extern byte bADC_Sample;
//STOP3_MODE_EXIT();
//TimeOut_init();
KBI_Read(); // check the key pressed
KBI1SC_KBACK = 1; // Acknowledge Interrupt and Clear flag
if ((ucKey_press != P_ucKey_press) || (TimerFlag[0] == TRUE)){
//j=i-1; //Test
//KeyStore[j] = ucKey_press; //Test
LCDPutChar(ucKey_press, i); // accept key entry
P_ucKey_press = ucKey_press;
i++;
if (i >=9)i=1;
TimerTable[0]=320; // set debounce time
TimerFlag[0]=FALSE;
if(TimerFlag[0]==FALSE){
bADC_Sample = TRUE;
}
}//endif
}//end interruptKBI
Error : C1815: ucKey_press not declared (or typename)
main.c line 35
Error : C1815: P_ucKey_press not declared (or typename)
main.c line 35
Warning : C1801: Implicit parameter-declaration for 'LED1_turnOn'
main.c line 37
Warning : C1420: Result of function-call is ignored
main.c line 37
Error : Compile failed