Digilent Basys MX3 Reference Manual page 18

Hide thumbs Also See for Basys MX3:
Table of Contents

Advertisement

7/30/2019
The usage of the RGB LED () is the same as controlling three separate LEDs, one for each color.
Figure 6.1 shows the way the RGB LED () is electrically connected on the Basys MX3.
There is one digital signal to control each color component. Using either 0 or 1 values for these signals will only give the user a limited
number of colors (2 colors for each component), so most of the time this is not enough in applications using the RGB feature. The solution
is to send a sequence of 1 and 0 values on these digital lines, switched rapidly with a frequency higher than human perception. The "duty
factor" will finally determine the color, as the human eye will "integrate" the discrete illumination values into the final color sensation.
The most used approach in solving this problem is the use of PWM (pulse width modulation) signals. Another approach is the use of PDM
(pulse density modulation). These methods are explained in the RGB Led implemented using PWM (pulse width modulation) and RGB Led
implemented using PDM (pulse density modulation) sections.
Label
Schematic Name
R
LED8_R
G
LED8_G
B
LED8_B
6.2. Functionality
6.2.1. RGB LED Implemented Using PWM
Pulse-width modulation (PWM) uses constant period pulses, where each pulse the "high" value is maintained for a certain time. The
percentage of each period that the pulse is high determines the signals "duty cycle". The following figure shows how different duty cycles
are implemented using PWM.
Using this method, the intensity of each component of the RGB LED () is determined by the duty cycle being applied to it.
PWM is most often implemented in the microcontroller using the Output Compare (OC) peripheral modules along with a timer.
One timer (Timer y) is assigned to the OC module. Setting the PRy register of the timer will set the PWM period. Setting the OCxRS
register of the OC module will set the actual duty cycle.
The PIC32 datasheet figure below explains how one period of the PWM is generated.
https://reference.digilentinc.com/reference/microprocessor/basys-mx3/reference-manual?_ga=2.68739409.1349070004.1564406803-1961480359....
Basys MX3 Reference Manual [Reference.Digilentinc]
PIC32 Pin
AN25/RPD2/RD2
RPD12/PMD12/RD12
AN26/RPD3/RD3
Description
Signal corresponding to the R component of the RGB
Signal corresponding to the G component of the RGB
Signal corresponding to the R component of the RGB
18/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