PSoC Lab 02: 4-Digit Seven Segment Display



  • Learn how to interface 4-digit seven segment display
  • Learn proper configuration of the Segment LCD component

Required Reading Material

Background Information

A 4-digit seven segment display has 12 pins; 8 of the pins are for the 8 LEDs on each of the seven segment displays, which includes A ~ G and DP (decimal point). The other 4 pins represent each of the 4 digits from D1 ~ D4. The pinout for the 4-digit seven-segment display is shown below.

4 digit 7 segment LED display pinout
Figure 1: The Pinout for 4-Digit Seven-Segment Display

Required Components List

FourDigitSevenSegmentDisplay 64 4-Digit Seven Segment Display x 1
Button Small 64 Push Button x 1
Resistor 64 Resistor: 220 ohm x 8


Circuit / Schematic Diagram



Check Lists

FIll the following configuration information into the report

  • Port.Pin configuration:
    Device Port.Pin Signal Type Direction: Drive Mode

TopDesign and PSoC Components

Add the following PSoC Creator components in the TopDesign:

topDesign 01Figure 1: TopDesign.cysch

Sample Code


#include "project.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>

int main(void)
    uint16_t    count = 0;
    CyGlobalIntEnable; /* Enable global interrupts. */

    /* Place your initialization/startup code here (e.g. MyInst_Start()) */
    LED_Write7SegNumberDec(count, 0, 4, LED_RIGHT_ALIGN);

        /* Place your application code here. */
        if (!nSW_Read()){
            LED_Write7SegNumberDec(count, 0, 4, LED_RIGHT_ALIGN); // Display a number from com0 for 4 digits

When you press and hold the SW, the system will count up from 0 to 9999. When you release SW, the system will stop the counting.



  1. What type of seven segment display you used in this lab? Common Anode (CA) or Common Cathode (CC)? How to identify it without using multimeter and search from datasheet or internet?
  2. What number will be displayed on the 4-digit seven segment LCD for the following code?
    uint32_t    count32 = 123456;
    LED_Write7SegNumberDec(count32, 0, 4, LED_RIGHT_ALIGN);