PrgBar:

    Now we will demonstrate how to create a Progress Bar on the STM32 Mini.

The registers and ports are, as usual, initialised in StartUp.Inc and this routine is basically the same as the one in the BitMap program. 

For a change we set up the pins on Led1 and Led2 as general purpose 50 MHz push pull outputs (12). Led1 and Led2 are then output

in anti-phase to the PortA Output Direction Register (14). Before we do this, we must enable the clocks for Ports A + B + C (8).

After initialising the Lcd, the program then moves onto to the Main Program routine in PrgRam.inc.

The attached BitMap is firstly drawn on the screen and then one can select one of four program times as follows:

pT:    THETA  is  selected by enabling lines (19-21) and this corresponds to a 60 Minute countdown time. 

pO:   OMEGA is  selected by enabling lines (23-25) and this corresponds to a 45 Minute countdown time. 

pD:    DELTA is  selected by enabling lines (27-29) and this corresponds to a 30 Minute countdown time. 

pA:    ALPHA is  selected by enabling lines (31-33) and this corresponds to a 15 Minute countdown time. 

pP:    The relevant parameters corresponding to the selected program time are then stored in the Ram register offsets between (35-40).

    The Send String to Lcd subroutine, LcdStr, is then called and the SysTick interrupt is initialised and enabled to occur every 233mS.

The routine PrgMin is called after every elapsed Minute and the Progress Bar is decremented corresponding to the contents of Ram register 

offset TimInd. The hexadecimal Minute count in register R9 is also decremented and sent to the Display, having firstly been processed by the

HexDec routine, with leading zero suppression, between lines (75-84). The converted minute number is then sent to the Lcd using the LcdChr

subroutine. The Program Loop routine PrgLup waits for the SysTick interrupt, which occurs every 233mS and this timeout is used to blink the 

Leds in anti-phase @2.146 Hz (98-100). The Ticks counter in register R8 is decremented and another Minute has elapsed when 258 Ticks have 

occured. When the CountDown time has elapsed, the Lcd is powered down and all clocks and peripherals are disabled. 

"What shall we do with the drunken sailor?"

Download