This blog series explains how to use the Educational BoosterPack LCD with a Hercules LaunchPad.
The Educational BoosterPak MKII is a hot item. It has many sensors on board. and a joystick, a buzzer, a 3-colored LED, buttons and a microphone.
And also a very nice color LCD screen.
The first post was an intro to my driver library for that LCD. In the previous one we set up the generic I/O.
This time it's PWM time. We'll do all the set-up to control the brightness of the LCD backlight.
Before diving head-first into the configuration, let's check the BoosterPack's schematics.
You can see that the backlight of the LCD is controlled by transistor Q4. We should feed a PWM signal into that transistor's base.
The duty cycle of that signal would then regulate the backlight brightness.
But if we'd just provide that PWM signal, we'd see that we don't drive the LCD backlight. It's the RGB LED's red die that lights up in stead.
Trace back the base signal of that transistor, and you'll see what's happening: the signal going to the basis of Q4 is shared with that RGB LED.
Jumper J5 lets you choose the function. By default it is routing the signal to the driver of the LED.
If we move the jumper to the down position (bridging pin 2 and 3), the signal connects to our Q4 via R32, and we're good.
The input signal (the one that goes to the middle pin of J5) is broken out to pin 39 of BoosterPack connector J4. That's the one that we'll drive with our Hercules LaunchPad.
The LaunchPad side
BoosterPack's J4.39 hits the J4.2 of the Hercules RM46 LaunchPad. That happens to be a dual purpose pin.
It's usable as a High End Timer (HET) or PWM signal. We'll use the HALCoGen PINMUX screen to give it PWM functionality.
Let's open HALCoGen and do the necessary configurations.
- Enable the PWM driver, and enable PWM module 6 (that's the one that drives ePWM6A)
- Set the multiplex option to PWM
- For the time being, configure the signal to have a duty cycle of 100% (full brightness) and a frequency above the audio range.
Once again, there's very little coding to do in our firmware.
#include "etpwm.h" // ... etpwmInit(); // ... etpwmStartTBCLK();
You can change the brightness of the backlight by calling the API function etpwmSetCmpA().