Objectives:
Interface segments display components with HCS12 controller, chose port A for carrying data and port E for segment activation.
I need this (Interface a keypad in port B and write program to restart the display content when there is a key press.)
Display all Alphabets and numerals in scrolling mode.
I've done so far this much and am lost with the keypad part will you please help me out !!

Source Code:
Code:
#include <hidef.h> /* common defines and macros */
#include <mc9s12e128.h> /* derivative information */
#pragma LINK_INFO DERIVATIVE "SampleS12"
void delay (int);
void delay (int x) {
int y;
while (x>0) {
for (y=0;y<5000;y++) {
;
}
x--;
}
}
void portInit (void) ;
void portInit() {
PORTE = 0X00;
DDRE = 0XFF;
PORTA= 0X00;
DDRA = 0XFF;
}
void main(void) {
void segment_display(char s ) ;
char alpha[] = {0X08,0X03,0X46,0X21,0X06,0X0E,0X10,0X09,0X79,0X71,0X7F,0X47,
0X7F,0X2B,0X40,0X0C,0X7F,0X0F,0X12,0X07,0X41,0X7F,0X7F,0X7F,0X11,0X7F
};
char segment[]={0X80,0X00};
char size ;
unsigned int disp;
char name[]="CALEDONIANZCOLLEGEZOFZENGINEERING";
portInit() ;
/* put your own code here */
EnableInterrupts;
for(;;) {
PORTE = PORTA ;
for(size=0;name [size] !='\0';size++) {
for (disp=0;disp<34;disp++){
PORTE = segment[0] |alpha[name[size]-65];
delay(20);
PORTA = segment[1] |alpha[name[size+1]-65];
delay (20);
PORTE = segment[2] |alpha[name[size]-65];
delay (20);
PORTA = segment[3] |alpha[name[size+1]-65];
delay (20);
PORTE = segment[4] |alpha[name[size]-65];
delay (20);
PORTA = segment[5] |alpha[name[size+1]-65];
delay (02);
PORTE = segment[6] |alpha[name[size]-65];
delay (20);
PORTA = segment[7] |alpha[name[size+1]-65];
delay (20);
}
}
} /* wait forever */
}
*
naturist.life@hotmail.com
thank you in advance
thank you in advance

