A Simple Method of          Displaying Numbers


    This page describes a simple method of displaying different numbers (up to three digits) on a single 7-segment display.

    First I'll show you the program (written in WCC11
):

int pn;

void printn()    // This procedure prints the number specified by 'pn'
{
    ...
}

int save;

void printf(pf)
{
    // This is the actual procedure that gets called by the main program
    // pf holds the number to be displayed (up to three digits decimal)
    pn = pf / 10;
    save = pn;
    pn = pn / 10;
    printn();  // display the contents of 'pn'
    delay();  // wait so the user can read the display
    pn = save ^/ 10;
    printn();
    delay();
    pn = pf ^/ 10;
    printn();
    delay();
}



See
a chart showing the variables changing while the printf procedure is called to print the 3-digit number 308, then another chart printing the number 49.

Home Page  |  Walt's Page