LEDS


The two LEDs on the STM32 boards are pretty minimal.  The docking board parallels those two LEDs (the GPIO outputs that drive the onboard LEDs also drive LEDs on the docking board), and adds two additional LEDs for a total of 4 LEDs, placed across the 4 columns of the button matrix.

CONFIGURATION SWITCHES

Configuration DIP switches are a useful tool to have on an educational microcontroller board.  The user can use such switches to switch between algorithms to compare them, or to switch between master / slave, or transmitter / receiver, or to provide some form of board addressing, among other uses.  4 DIP switches are provided on the docking board.  They are isolated with resistors so that if the pins connected to them are set as outputs, the outputs cannot be damaged no matter how the switches are set.

ADC (ANALOG TO DIGITAL CONVERTER) POTENTIOMETER

A simple 10k or 20k potentiometer is very useful in learning how to work with your microcontroller’s ADC.  The docking board has such a potentiometer with the center pin connected to a GPIO pin which can be configured as an ADC input.  Note that not all GPIO pins can be used as ADC inputs – which ones can be used will be indicated on the datasheet.  One end of the pot is connected to ground, and the other end is connected to the Vcc of the uC.  Voltages on any ADC input must always be within the range of GND->Vcc to prevent damage to the microcontroller.

For further experimentation, additional ADC-capable GPIO are brought out to some of the docking board expansion connectors.

FIRST STEP – ADDING AN LCD DISPLAY

Adding a display is a smart first step because a display lets us see what is going on inside our uC, and is also a very useful debugging aid when things are going wrong.  The display will require a minimum of 6 GPIO outputs, preferably all on a single port as discussed above.  Also required is either a transistor (mosfet or bjt) to switch the backlight on or off, or else just hardwiring the backlight on.  If using a transistor you will need to select a GPIO output to drive the transistor.  This can be any bit on any port.

Many newbies seem to have difficulty programming the HD44780-compatible displays.  I’ve never had a problem with them once I’ve read the datasheet carefully (you have downloaded a datasheet off the internet, right?).  Perhaps the most crucial issue is to get the timing right.  A particular delay is required after each initialization step, and whenever writing to the display in general.  In addition, the enable (‘E’) pulses to the display must exceed a minimum duration.  You must get these all of delays correct for the display to work.  Longer is OK, but shorter and your display will not work at all, or it will be flakey.  So, we’re back to talking about delays.  In particular, we need a delay of about 1us for the ‘E’ pulse (actually, >230ns), a delay of about 50us between each character write, and some delays in the milliseconds range.  So let’s refine our old delay() function to generate reasonably accurate microsecond and millisecond delays.

Related Posts

© 2024 Electronics Engineering - Theme by WPEnjoy · Powered by WordPress