7-Segments-Board for Embedded Systems

-->

 

Design and Implementation of 7-Segments-Board 1.0

Basic Extension Module for Embedded System Prototype

 

By: Ivan Christian and Erwin

 

Introduction

When developing embedded systems, it would be helpful if we could have a module for monitoring purpose. For instance, let say that your system has to process data streams. In testing and verification step, we need to compare each input and output bytes, so that we can verify that your system is doing right. Having a monitor module is surely a great help for engineers.

Some development board has monitor module integrated, such as Altera UP1X FPGA Development Board. Inspired by its usage and benefit of such monitor, 7-Segments-Board 1.0 is designed as an extension module for embedded system prototype.

Description

7-Segments-Board 1.0 is a low-cost low-power MCU extension module for monitoring purpose. Its aim is to help engineers doing the firmware testing and debugging on hardware prototype. For those who build microcontroller prototype device from scratch and do not have access to sophisticated debugging instruments, using this module would make testing and verification process less painful. 7-Segments-Board 1.0 is designed for 8-bit microcontroller system.

Module Specifications

The module specifications are as follows:

  1. Input:
    • General purpose push-button (PB) switches (dry contact).
  2. Output:
    • Seven-segments LED to display 8-bit data in hex format at minimum.
  3. Low power consumption

Driving LED continuously consumes much amount of power. So it is desirable to minimize power loss in limiting resistors.

  1. Minimum port usage

7-Segments-Board 1.0 is designed to work well with minimum I/O pin resources, as I/O ports are strictly limited in common embedded system.

Block Diagram

Figure 4.1 shows the block diagram of 7-Segments-Board 1.0. In general the module consists of decoders, LED drivers, 7-segments LED display, serial-in parallel-out (SIPO), and PB switches.

We only allocated 1 MCU Port (8 pins + 2 power lines) for module interfacing. SIPO is used to minimize port pins. The minimum total number of pin for driving SIPO is 3 pins only.

In order to drive 7-segments LED display with small power, decoder and SIPO works together to multiplex the display. It takes input signal frequency of 20-25 Hz (i.e. 40-50 ms period) at minimum to flash the display on and off so that human eyes don’t see the flicker. The number of 7-segments display depends on MCU I/O port availability and it sizes up the decoder as well. In this module two 2-digit-in-1-package of 7-segments LED components are used. It means this module can display 4 digits at once. Therefore 2-to-4 decoder is used. Total number of pin for decoder is 2 pins.

PB switches is integrated in the module for any purposes, such as to switch the display from one mode to another. The rest pin available (3 pins) is used for these switches.

seven_segment1.gif

Figure 4.1 Block Diagram of 7-Segments-Board 1.0

Tools

Primary tools used for design and implementation of 7-Segment-Board 1.0 are as follows:

  1. Hardware
    • AVR ISP Development Board (designed by Erwin)
    • Atmel ATmega8535
  2. Software
    • Altium Design Explorer Version 7.2.85
    • WinAVR 20050214

Schematic Capture

See schematic file (SevenSeg_Sch_04172006.SchDoc) in the attached zip file. Notice that Output Enable pin (N_OE) and Master Reset pin (N_MR) is tied to VCC and GND respectively. Therefore total number of pin to control SIPO is reduced from 5 pins to 3 pins.

PCB Layout Capture

See PCB file (SevenSeg_Pcb_04182006.SchDoc) in the attached zip file. Note that physical board is implemented using 2-layer PCB with through hole. Figure 7.1 is the picture of physical board.

seven_segment2.jpg

Figure 7.1 Physical Board of 7-Segments-Board 1.0

pinout.gif

 

Figure 7.2 Pin configuration of I/O Port

Tabel 7.1 List of Primary Components

Component Name

Units

Notes

2-digit-in-1-package 7-segments LED

2

Display units

74HCT595

1

3-States SIPO Buffer

74HC139

1

2-to-4 Decoder

2N2907

4

PNP LED driver

PB Switch

3

General purpose

C 100nF Ceramic

2

Decoupling C

R220 1/2W

8

LED current limiting R

R10K 1/2W

8

LED driver bias circuit

R1K 1/2W

3

Pull up R for switches

Firmware Design

This project use Atmel AVR family microcontroller for driver implementation. No particular reason but tools availability that makes the decision. The module driver, written in C, consists of 4 separate files to simplify the maintenance: main.c, port.h, sevenseg_drv.c, and sevenseg_drv.h. The main.c file is the main program that is used to test and verify the driver. The port.h and sevenseg_drv.h files are self-explanatory. The sevenseg_drv.c contents 3 functions that do display multiplexing, that is:

  • void init_sevenseg(void)
          1. It selects which digit is activated by controlling the decoder.

          2. Then the program sends the parameter to SIPO by function send_data(uint8_t data).

          3. After short delay, the program erases the displayed digit before it activates the next digit, so the next digit to come doesn’t shadow the last active digit.

      1. This function is responsible to multiplex display digits. Each digit is named and coded after its position. As seen on Figure 7.1, from right to left, MSD1, LSD1, MSD0, and LSD0 is coded 0, 1, 2, and 3, respectively. When this function is called, each digit would be flashed (based on the parameters entered) one by one from code 0 to code 3. Three main steps are used as follows:

        The steps above is repeated after all digit are flashed.

        For Testing and Verification refer to Seven Segment Monitor documentation

        Portability

         

        The source can be translated to other MCU (8051, PIC) with minor modification.

        Conclusion

        From this project, we can conclude several points as follows:

        1. Multiplexing display is less bright than continuous display, but the power loss is reduced.
        2. By multiplexing the display in frequency greater than 25Hz, we can avoid our eyes seeing flickering display.


        Advices

        To improve 7-Segments-Board 1.0, it is recommended to lower the value of current limiting resistors of the display to less than 220 ohms.

        References

        [1] 74HC/HCT139 Dual 2-to-4 line Decoder/Demultiplexer – datasheet. Philips Semiconductors. September 1993

        [2] 2N2907 PNP General Purpose Amplifiers and Switches – datasheet. SGS-Thomson Microelectronics. November 1997

        [3] 74HC/HCT595 8-bit serial-in/serial or parallel-out shift register with output latches; 3-state – datasheet. Philips Semiconductors. June 1998

        Download project documentation, schematic and PCB design Seven Segment Monitor

        Thanks to Ivan for sharing the project

         

         

    1. It sends 8-bits data in MCU register serially to SIPO. Each bit is transmitted consecutively from MSB to LSB along with clock signals (SHCLK, STCLK). SHCLK is used to shift bit serially, and STCLK is used to pass the shifted data into SIPO output register. Data can only be seen at SIPO output register after SIPO receives STCLK pulse. Thus it takes 8 pulse of SHCLK and 1 pulse of STCLK to transmit 8-bit data from MCU to SIPO.

      • void mx_display(uint8_t MSD1,uint8_t LSD1,uint8_t MSD0,uint8_t LSD0)
  1. This function initiates data direction register (DDRx) and Data Register (PORTx) of AVR ports used. PORTA is used for module interfacing, and PORTC is used for debugging purpose.

    • void send_data(uint8_t data)

Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post
 |  TrackBack URI for this post

New on WinAVR Tutorial
Running TX433 and RX433 RF modules with AVR microcontrollers,
Sometimes in embedded design you may want to go wireless. Might be you will want to log various readi …
Programming AVR ADC module with WinAVR,
Most of AVR microcontrollers have Analog to Digital Converter (ADC) integrated in to chip. Such solut …
New on WinARM Tutorial
What are differences between WinARM and WinAVR,
Everyone who is working with AVR microcontrollers knows this powerful tool – WinAVR (http://win …
LPC2000 watchdog timer,
As in all microcontrollers watchdog timers purpose isto reset microcontroller after reasonable amount …

One Response to “7-Segments-Board for Embedded Systems”

  1. scienceprog Says:

    Because of database crash Latest comments were lost. I am rewriting the link to project schematic.
    Schematic

    If there is anything else needed or missing just let me know.

Leave a Reply