2018-12-04 02:10 PM
Hi,
When A0 is used as Register select in the FMC LCD interface, ST uses the code below:
typedef struct
{
__IO uint16_t REG;
__IO uint16_t RAM;
}LCD_CONTROLLER_TypeDef;
/* We use BANK1 as we use FMC_NE1 signal */
#define FMC_BANK1_BASE ((uint32_t)(0x60000000 | 0x00000000))
#define FMC_BANK1 ((LCD_CONTROLLER_TypeDef *) FMC_BANK1_BASE)
FMC_BANK1->RAM = Data; //Write Data
FMC_BANK1->REG = cmd; ///write CMD
How to do it when the Register select is A19?
2018-12-04 02:15 PM
Sure you can mapped it any way the pins permit. Depending on the data width the address bit number will shift on the external pins.
2018-12-04 02:36 PM
Clive,
I would like to know how to change the code to work when A19 is the Register select. ST example only works for A0 as Register selec.
2018-12-04 02:48 PM
On an 8-bit interface FMC_BANK1_BASE vs (FMC_BANK1_BASE + (1 << 19))
ie
uint8_t *RAM = (uint8_t *)(FMC_BANK1_BASE + (1 << 19)); // 8-bit one-to-one mapping
uint16_t *RAM = (uint16_t *)(FMC_BANK1_BASE + (1 << (19 + 1))); // A19 externally A20 internally
*RAM = Data;
2018-12-04 02:53 PM
typedef struct
{
__IO uint16_t REG;
__IO uint16_t LARGEVOID[(1 << 19)-1]; // already described one word
__IO uint16_t RAM;
}LCD_CONTROLLER_TypeDef;