Digilent Basys MX3 Reference Manual page 15

Hide thumbs Also See for Basys MX3:
Table of Contents

Advertisement

7/30/2019
4.1. Connectivity
Table 4.1. Switches connectivity.
Label
Schematic Name
SW0
SW0
SW1
SW1
SW2
SW2
SW3
SW3
SW4
SW4
SW5
SW5
SW6
SW6
SW7
SW7
All the pins must be defined as digital input: their corresponding TRIS bit must be set to 1, and analog function must be disabled for pins
routed to SW5, SW6 and SW7.
TRISFbits.TRISF3 = 1;
TRISFbits.TRISF5 = 1;
TRISFbits.TRISF4 = 1;
TRISDbits.TRISD15 = 1; // RD15 (SW3) configured as input
TRISDbits.TRISD14 = 1; // RD14 (SW4) configured as input
TRISBbits.TRISB11 = 1; // RB11 (SW5) configured as input
ANSELBbits.ANSB11 = 0;
TRISBbits.TRISB10 = 1; // RB10 (SW6) configured as input
ANSELBbits.ANSB10 = 0; // RB10 (SW6) disabled analog
TRISBbits.TRISB9 = 1;
ANSELBbits.ANSB9 = 0;
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;
val = PORTFbits.RF5;
val = PORTFbits.RF4;
val = PORTDbits.RD15; // read SW3
val = PORTDbits.RD14; // read SW4
val = PORTBbits.RB11; // read SW5
val = PORTBbits.RB10; // read SW6
val = PORTBbits.RB9;
https://reference.digilentinc.com/reference/microprocessor/basys-mx3/reference-manual?_ga=2.68739409.1349070004.1564406803-1961480359....
Basys MX3 Reference Manual [Reference.Digilentinc]
PIC32 Pin
RPF3/RF3
RPF5/PMA8/RF5
RPF4/PMA9/RF4
RPD15/RD15
RPD14/RD14
AN11/PMA12/RB11
CVREFOUT/AN10/RPB10/CTED11PMA13/RB10
AN9/RPB9/CTED4/RB9
// RF3 (SW0) configured as input
// RF5 (SW1) configured as input
// RF4 (SW2) configured as input
// RB11 (SW5) disabled analog
// RB9 (SW7) configured as input
// RB9 (SW7) disabled analog
// read SW0
// read SW1
// read SW2
// read SW7
Pin Shared With
Description
Switch 0
Switch 1
Switch 2
Switch 3
Switch 4
Switch 5
Switch 6
TRIG_2
Switch 7
15/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