Programming Basics - Digilent Basys MX3 Reference Manual

Hide thumbs Also See for Basys MX3:
Table of Contents

Advertisement

Basys MX3™ Board Reference Manual
Another useful tool included with MPLAB X is MPLAB X IPE. This tool allows the direct programming/erasing of the
microcontroller, but it does not provide an environment for writing, compiling, or debugging the code. Please see
Microchip documentation for instructions on using this tool.
1.2

Programming Basics

It is often very helpful to include the xc.h header when writing code for the Basys MX3:
#include <xc.h>
This further provides the inclusion of another header (p32mx370f512l.h) into the project that provides useful
definitions such as:
Register names
o
example (register LATA is set to 0):
LATA = 0;
Specific register bits that can be accessed using a structure having the name of the register suffixed by
"bits".
o
example (bit LATA1 of the register LATA is set to 1):
LATAbits.LATA1 = 1;
Digilent provides a set of libraries called the Basys MX3 Library Pack that addresses much of the functionality on
the Basys MX3:
ACL (accelerometer)
ADC (analog-to-digital converter)
AUDIO
BTN (buttons)
IRDA
LCD
LED
MIC (microphone)
MOT (motors)
PMODS
RGBLED
SPIFLASH
SSD
SWT (switches)
UART
These libraries are wrappers over the lower level functions that access the registers, allowing the user to call the
functionality using functions like:
LED_Init();
LED_SetValue(4, 1); //turn on LED4
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 8 of 56

Hide quick links:

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?

Questions and answers

Table of Contents