.

QuickBuilder
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

Introduction
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.

Operation
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 :
"12.34"
"1.2.3.4"
" .012"
"-34.0"
"0.6E3"
" 256"
"Err"


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>
#include 

#fuses   XT,NOPROTECT,NOWDT


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


#INCLUDE "muxd.c"


#int_rtcc
void RTCC_ISR()
    {
    MUXD_1DO();    // refresh display
    }


void main()
    {
    int c='0';
    
    INIT_SUB_CIRCUITS();    

    
    setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
    enable_interrupts(RTCC_ZERO);
    enable_interrupts(GLOBAL);
    
    while(1) {
        if (RS232_1INCOMING() ) {        
            disable_interrupts(RTCC_ZERO);
            c = RS232_1IN();
            enable_interrupts(RTCC_ZERO);
            MUXD_1PUTC(c);	        
        }       
    }
}

Copyright 2002-2009 Summit Electronics Ltd
www.quickbuilder.co.uk