Hello World:

    Now let's move onto the most complex peripheral on board the STM32 Mini; namely  the Lcd display. 

Firstly you can download the data sheet for the display right here ... 

And you can now initialise the registers and peripherals for the program in StartUp.inc as follows:

1:    Enable the Clocks for both PortB and PortC only (7-9)

2:    Configure PortB bits 8 to 15  as general purpose 50 MHz, Push-Pull Outputs (11-13)

3:    Configure PortC bits 0 to 7   as general purpose 50 MHz, Push-Pull Outputs (15) 

4:    Configure PortC bits 8 to 11  as general purpose 50 MHz, Push-Pull Outputs (16-17)  

5:    Configure PortC bit 12  as a general purpose Open Collector Output (16-17)

6:    Set  PortC bits 8 to 12  all High (18-19)

Please note, that I've decided to use register R11 as a Global pointer for all the Port Registers (11) with the following Offsets:

A:    PortA = Offset 0x0000

B:    PortB = Offset 0x0400

C:    PortC = Offset 0x0800

D:    PortD = Offset 0x0c00

Register R10 is now dedicated as a Global pointer for accessing User Ram Variables (5). All Offsets can be found in Defines.inc.

The iLi9325 Lcd is initialised with the usual 40mS delays between lines (23-154), and the Null- terminated "Hello World" string 

in Tables.inc is finally sent to the display. Before that, the Lcd is washed clear using Grey as the BackGround color (156-158). 

The  characters are sent to the display using White as the ForeGround color (160-161). The String Source Pointer is stored in the

Word-Ram location SrcPtr (162-163) and the Lcd Destination Start Pointer is stored in the LcdPtr Word-Ram location (164-165).

The Lcd Destination X-axis location is specified by the Upper 16-Bits = Ox0050 and the Y-Axis location is determined by the Lower 16-Bits =  0x00a0.

For a clearer elucidation of this routine, please consult the STM32 Mini Hardware layouts in the attached Schematics folder.

Thanks a million to Bonze for allowing me to "translate" his iLi9325 initialisation code, which he wrote in AVR-Bascom code ... see Attachment :-)

"Old AVR programmers never die. They only go Rcall without Ret."

Download