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 16 of 56
TRISBbits.TRISB9 = 1; // RB9 (SW7) configured as input
ANSELBbits.ANSB9 = 0; // RB9 (SW7) disabled analog
4.2 Functionality
In order to read the switches, the user needs to read the corresponding digital input pin. A value of 1 indicates the
switch as being on (high) or 0 indicates the switch as being off (low).
val = PORTFbits.RF3; // read SW0
val = PORTFbits.RF5; // read SW1
val = PORTFbits.RF4; // read SW2
val = PORTDbits.RD15; // read SW3
val = PORTDbits.RD14; // read SW4
val = PORTBbits.RB11; // read SW5
val = PORTBbits.RB10; // read SW6
val = PORTBbits.RB9; // read SW7
Library functions for using the switches are contained in the Basys MX3 library pack, SWT library; however, the
user can easily use the switches without the SWT library, as presented above.
4.3 Shared Pins
As shown in the connectivity table above, SW7 driving signal is shared with the TRIG_2 signal in 2x15 pins Debug
Header.
5 User Buttons
There are five buttons on the board, labeled BTNU, BTNL, BTNC, BTNR, BTND both on the board and in the
schematic, attached to five digital I/O pins of PIC32. Reading the buttons is done by basic access to an input I/O
pin. Read more details in Digital Inputs and Outputs section.
Figure 5.1 shows the way the buttons are electrically connected on the Basys MX3.