Seven Segment display source code AID plz help !!

Discussion in 'C' started by naturist, Dec 1, 2009.

  1. naturist

    naturist New Member

    Joined:
    Dec 1, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I've been asked to make a Seven segment display based project:

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


    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() ;
    
      
    
     [COLOR=Red] /* put your own code here */[/COLOR]
      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 */
    }
    please mail me the solution to:
    *
    naturist.life@hotmail.com

    thank you in advance
     
    Last edited by a moderator: Dec 1, 2009
  2. Gene Poole

    Gene Poole New Member

    Joined:
    Nov 10, 2009
    Messages:
    93
    Likes Received:
    5
    Trophy Points:
    0
    Is this microcontroller code?
     
  3. naturist

    naturist New Member

    Joined:
    Dec 1, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0

    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
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice