- ARM

0-99 7 segment Counter on LPC2148 ARM7 Development Board

Fig 1 7 Segment LED Display
 
0 – 99 7 Segment(SSD) Counter on LPC2148 ARM7 Development Board


What is 7 Segment Display(SSD)?  – A seven-segment display is a form of electronic display device for displaying decimal numbers (and some alphabets too). 7-segment displays are simply 7 LEDs placed in one same package.  To change the displayed value, we simply turn on or off different combinations of LEDs.

 

Types of 7 Segment : – There are two types of 7-segment displays: Common Anode(CA) and Common Cathode(CC).  In common anode displays, the anode of the LEDs are connected to one pin (usually connected to a power source).  In common cathode displays, the cathodes are connected to one pin (usually connected to ground).

Fig 2 Common Anode and Common Cathode Diagram Representation
 
 
 
 
This code is tested in Keil uVision 4. Developed for ARM LPC2148  kit of ALS Advanced Systems Board.
 
There are two multiplexed 7-segment displays LT543 (U8 and U9) on the board.
Seg_A connected to P0.16 
Seg_B connected to P0.17 
Seg_C connected to P0.18 
Seg_D connected to P0.19 
Seg_E connected to P0.20 
Seg_F connected to P0.21 
Seg_G connected to P0.22 
Seg_DP connected to P0.23 
Common cathode of U8 –> P0.28 
 
Common cathode of U9 –> P0.29
 

Values to be sent to the Ports:

In following table, we convert 8 pin’s 8 bit binary data into hex code and this data is sent to ports.
Fig 3 7 Segment Hex Numbers
 
 

 

 
ARM Code :

 

;/*Program to Count 0-99 on 7 Segment ARM LPC2148*/
#include<LPC214x.h>
int main()
{ 
 int segData[16] = {
 0x003F0000,// 0
 0x000
60000,// 1
 0x005B0000,// 2
 0x004F0000,// 3
 0x00660000,// 4
 0x006D0000,// 5
 0x007D0000,// 6
 0x00070000,// 7
 0x007F0000,// 8
 0x006F0000,// 9
 0x00770000,// A
 0x007C0000,// B
 0x00390000,// C
 0x005E0000,// D
 0x00790000,// E
 0x00710000 //F
  };
 int i = 0,j = 0,k = 0,Count = 9; 
 PINSEL0 = 0x00000000;
 IODIR0 = 0x30FF0000;
 IOSET0 = 0x30FF0000;
 while(1)
 {
 for(i = 0; i<=Count; i++)
 {
  for(j = 0; j<=Count; j++)
  {
   for(k = 0; k<=200000 ; k++)
   {
    IOCLR0 = 0x10FF0000;
    IOSET0 = segData[j];
    IOSET0 = 0x10FF0000;
    IOCLR0 = 0x20FF0000;
    IOSET0 = segData[i];
    IOSET0 = 0x20FF0000;
   }
  }
 }
 }
}

Download Code:

 To Download the Code click on the link below:

Download
 
 
  •  

 

 
 

Leave a Reply