Go Down

Topic: Tutorials/Experiments on AT89S52 Microcontroller Programming  (Read 2452 times) previous topic - next topic

GolamMostafa

Experiment-2 Driving CC-type 7-segment Multiplexed Display Unit using 89S52 MCU


Figure-1: 2-digit cc-type multiplexed display unit


Task-A  Add the binary numbers 0x37 and 0x33 and show the result on DP0-DP1 positions of the display unit of Fig-1.

Program Codes using MIDE-51 SDCC (untested)

Code: [Select]
#include <8052.h>

void delay(unsigned int y);

void main()
{
  
  static idata unsigned char lupTable[] = {
  0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x77, 0x71
                                           };
  
  unsigned char x, y, z;
  
  z = 0x37 + 0x33;  //z = 6A
  
  //HEX to CC-code Conversion
  x = z>>4;
  x = lupTable[x];    //x contains cc-code of 6
  y = z & 0x0F;
  y = lupTable[y];    //y contains cc-code of A
  
  while(1)
  {
    P2 = x;     //show 6 at DP0 position
    P1_1 = 0;    
    P1_2 = 1;
    delay(300);
    
    P2 = y; //show A at DP1 position
    P1_1 = 1;
    P1_2 = 0;
    delay(300);
  }
}

void delay(unsigned int y)
{
  int i;
  for (i = 0; i<y; i++)
  {
    ;
  }
}


Task-B Add the binary numbers 0x23 and 0x17 and show the corresponding decimal number 58 on the display unit of Fig-1.     


PhysX

Unfortunately i removed all my circuitry without taking a picture. I am sorry about that. Please give me the next tutorial and i will give you the video of the working gadgets!!

GolamMostafa

Forum members must be willing to see the progress of your efforts having had seen the pictorial view of your setup. Heve you solved Task-B of Experiment-2? Please upload the camera capture where we will be able to see 58 on DP0-DP1 positions of Post#15.

The next Experiment could be on AD0834 Serial ADC.

Go Up