User manual
Basys MX3™ Board Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 23 of 56
All the pins (AN0-3, CA-CG and DP) must be configured as digital output and Anode 0 and Anode 1 must have the
analog functionality disabled:
TRISBbits.TRISB12 = 0; //RB12 set as output
ANSELBbits.ANSB12 = 0; //RB12 analog functionality disabled
TRISBbits.TRISB13 = 0; //RB13 set as output
ANSELBbits.ANSB13 = 0; //RB13 analog functionality disabled
TRISAbits.TRISA9 = 0; //RA9 set as output
TRISAbits.TRISA10 = 0; //RA10 set as output
TRISGbits.TRISG12 = 0; //RG12 set as output
TRISAbits.TRISA14 = 0; //RA14 set as output
TRISDbits.TRISD6 = 0; //RD6 set as output
TRISGbits.TRISG13 = 0; //RG13 set as output
TRISGbits.TRISG15 = 0; //RG15 set as output
TRISDbits.TRISD7 = 0; //RD7 set as output
TRISDbits.TRISD13 = 0; //RD13 set as output
TRISGbits.TRISG14 = 0; //RG14 set as output
7.2 Functionality
A seven-segment display controller is implemented in the SSD library of the Basys MX3 library pack. Here are some
details on the implementation of the library:
One array contains constant values for the segment’s configurations (one bit for each segment)
corresponding to various digits (0-9, A-F).
When the user selects the values to be displayed, they are used as index into this segment’s configuration
table and the resulting configuration bytes are stored in global variables.
Timer1 is used to generate interrupts every 3ms (corresponding to the period register PR1 = 3750).
Every time the interrupt handler routine is called, the following operations are performed:
o The next digit becomes the current digit, in a circular approach (thus each digit will be addressed
once after 4 calls of the interrupt handler routine).
o All digits are deactivated by outputting 1 to their corresponding anodes.
o The cathodes are outputted according to the segment’s information corresponding to the
current digit.
o The current digit is activated (0 is outputted to its corresponding anode).