Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Seven Segment display source code AID plz help !! (http://www.go4expert.com/forums/seven-segment-display-source-code-aid-t20251/)

naturist 1Dec2009 20:37

Seven Segment display source code AID plz help !!
I've been asked to make a Seven segment display based project:


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 !!:confused:

Source 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++) {

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,
char segment[]={0X80,0X00};
char size ;
unsigned int disp;

portInit() ;


  /* put your own code here */
  for(;;) {
  for(size=0;name [size] !='\0';size++) {
    for (disp=0;disp<34;disp++){
      PORTE = segment[0] |alpha[name[size]-65];
      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 */

please mail me the solution to:

thank you in advance

Gene Poole 2Dec2009 03:22

Re: Seven Segment display source code AID plz help !!
Is this microcontroller code?

naturist 2Dec2009 11:42

Re: Seven Segment display source code AID plz help !!

Originally Posted by Gene Poole (Post 61026)
Is this microcontroller code?

yes it is, i just want a start point and ill finish it up myself, it's like it's bit different that the original C#...thnx

All times are GMT +5.5. The time now is 09:48.