Digilent Basys MX3 Reference Manual page 17

Hide thumbs Also See for Basys MX3:
Table of Contents

Advertisement

7/30/2019
TRISBbits.TRISB1 = 1; // RB1 (BTNU) configured as input
ANSELBbits.ANSB1 = 0; // RB1 (BTNU) disabled analog
TRISBbits.TRISB0 = 1; // RB1 (BTNL) configured as input
ANSELBbits.ANSB0 = 0; // RB1 (BTNL) disabled analog
TRISFbits.TRISF4 = 1; // RF0 (BTNC) configured as input
TRISBbits.TRISB8 = 1; // RB8 (BTNR) configured as input
ANSELBbits.ANSB8 = 0;
TRISAbits.TRISA15 = 1;
5.2. Functionality
In order to read the buttons, the user needs to read the corresponding digital input pin, a value of 1 indicating the button is pressed or 0 -
indicating the button is released:
val = PORTBbits.RB1;
val = PORTBbits.RB0;
val = PORTFbits.RF0;
val = PORTBbits.RB8;
val = PORTAbits.RA15;
Please note that if you want the buttons to trigger a specific functionality, proper software debouncing is required.
Library functions for using the buttons are contained in the Basys MX3 library pack, BTN library. However, the user can easily use the
buttons without the BTN library, as presented above.
5.3. Shared Pins
As shown in table 5.1 above, some pins are shared:
Buttons BTNL and BTNU share functions with PGD and PGC signals used for programming. Therefore, the following line should
be inserted in the code, to disable their programming function.
#pragma config JTAGEN = OFF
Buttons BTNR and BTND share the pins with S0_PWM and S1_PWM, explained in the Servo Headers section, so these resources
should be used exclusively.
BTNC is shared with TRIG_1 signal in 2×15 Pins Debug Header, so it can be used to trigger events in an Analog Discovery board
experiment.
6. RGB LEDs
The Basys MX3 board contains one tri-color (RGB) LED (). The LED () allows the user to obtain any RGB color by configuring the R, G
and B color components.
https://reference.digilentinc.com/reference/microprocessor/basys-mx3/reference-manual?_ga=2.68739409.1349070004.1564406803-1961480359....
Basys MX3 Reference Manual [Reference.Digilentinc]
// RB8 (BTNR) disabled analog
// RA15 (BTND) configured as input
// read BTNU
// read BTNL
// read BTNC
// read BTNR
// read BTND
17/52

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Basys MX3 and is the answer not in the manual?

Table of Contents