for Microchip PICs

Home - About- Consulting* - Articles - FAQs - Contact
Tour - Application Example - Sub circuits - Projects - Download
Projects: Serial 7-segment multiplexed display demonstration
This QuickBuilder project can be downloaded here.

Serial 7-segment multiplexed display demonstration

This demonstration shows an implementation of the multiplexed 4-digit 7-segment display sub-circuit 'Display 4-dig 7-seg (com anode)' with serial interface. The target device is a PIC16F84 running at 4MHz.

When a character is received by the RS232 port, print it to the display unless it is 0x0D (carriage return) in which case move the cursor to the home position.

Example strings that can be sent to the display are :
" .012"
" 256"

Application code
Below is the application code for this project. To use it, select and copy (ctr-insert) the below and past it into a text editor and save as a 'C' file in your working directory. You may also need to change the build output path using 'Project | Options'

Note how the multiplexed display is refreshed by calling MUXD_1DO() regularly in the RTCC overflow interrupt service routine.

////                           APPMUXD.C                           ////
////                                                               ////
////  Demo application of simple serial driven multiplex 7-segment ////
////  display.                                                     ////
////                                                               ////
////  This program is an example of how your application code is   ////
////  is organised. Note the #include "muxd.c", this include       ////
////  file was generated by QuickBuilder and contains all          ////
////  driver code.                                                 ////
////                                                               ////
////  This demo is intended for  a PIC16F84                        ////
////  Compile using CCS 'C'  visit www.quickbuilder.co.uk/qb/ccs   ////

#include <16F84.H>


#define PORTA 5 
#define PORTB 6
#define TRISA 0x85 
#define TRISB 0x86

#INCLUDE "muxd.c"

void RTCC_ISR()
    MUXD_1DO();    // refresh display

void main()
    int c='0';

    while(1) {
        if (RS232_1INCOMING() ) {        
            c = RS232_1IN();

Copyright 2002-2009 Summit Electronics Ltd