2012-12-12 01:09 AM
I am trying to use an LCD HD44780 (2X40) with STM3210C-eval. I want to configure it for 8 bits mode.
#re-inventing-the-wheel2012-12-12 04:22 AM
I am trying to use an LCD HD44780 (2X40) with STM3210C-eval. I want to configure it for 8 bits mode.
Ok, but aren't there like thousands of example drivers on the internets already? As a minimal post here consider: A link to a datasheet on your specific panel. A schematic or wiring diagram for your specific configuration. A link or attachment of the current code.2012-12-13 01:49 AM
I can write data on the LCD with 4bits mode (LCD_4bits from keil), I want to change the mode to 8bits. I need the pins assignements.
this is the configuration for 4bits_mode: /* PINS: - DB4 = PC3 - DB5 = PC2 - DB6 = PC1 - DB7 = PC0 - E = PC10 - RW = PC11 - RS = PC12 */ #define PIN_E ( 1 << 10) #define PIN_RW ( 1 << 11) #define PIN_RS ( 1 << 12) #define PINS_CTRL (0x07 << 10) #define PINS_DATA (0x0F << 0) #define PINS_ALL (PINS_CTRL | PINS_DATA) const unsigned int SWAP_DATA[16] = { 0x0, 0x8, 0x4, 0xC, 0x2, 0xA, 0x6, 0xE, 0x1, 0x9, 0x5, 0xD, 0x3, 0xB, 0x7, 0xF}; /* Enable Clock for peripheral driving LCD pins */ #define LCD_CLOCK_EN (RCC->APB2ENR |= (1 << 4)); // enable clock for GPIOC /* pin E setting to 0 or 1 */ #define LCD_E(x) GPIOC->ODR = (GPIOC->ODR & ~PIN_E) | (x ? PIN_E : 0); /* pin RW setting to 0 or 1 */ #define LCD_RW(x) GPIOC->ODR = (GPIOC->ODR & ~PIN_RW) | (x ? PIN_RW : 0); /* pin RS setting to 0 or 1 */ #define LCD_RS(x) GPIOC->ODR = (GPIOC->ODR & ~PIN_RS) | (x ? PIN_RS : 0); /* Reading DATA pins */ #define LCD_DATA_IN SWAP_DATA[(((GPIOC->IDR & PINS_DATA) >> 0) & 0x0F)] /* Writing value to DATA pins */ #define LCD_DATA_OUT(x) GPIOC->ODR = (GPIOC->ODR & ~PINS_DATA) | ((SWAP_DATA[x]) << 0); /* Setting all pins to output mode */ #define LCD_ALL_DIR_OUT GPIOC->CRL = (GPIOC->CRL & 0xFFFF0000) | 0x00003333; \ GPIOC->CRH = (GPIOC->CRH & 0xFFF000FF) | 0x00033300; /* Setting DATA pins to input mode */ #define LCD_DATA_DIR_IN GPIOC->CRL = (GPIOC->CRL & 0xFFFF0000) | 0x00004444; /* Setting DATA pins to output mode */ #define LCD_DATA_DIR_OUT GPIOC->CRL = (GPIOC->CRL & 0xFFFF0000) | 0x00003333;2012-12-13 02:03 AM
''I need the pins assignements''
It's your project - so it's up to you to assign whatever pins are available/suitable/conventient in your particular application!
2012-12-13 02:20 AM
I tried but there is no result. i can't write data.
2012-12-13 03:47 AM
So you've done some thing(s) wrong - in your hardware, or in your software, or both.
Time for you to get checking & debugging... As clive1 said, there are thousands of example drivers on the internets already!2012-12-13 06:33 AM
It would be more effective if you wired up your 8-bit bus with consecutive GPIO pins so that the bus isn't backward like it is for your 4-bit bus.
Perhaps you should look at your board schematic and figure out what pins are free.2012-12-13 07:02 AM
Your reversal of the ''normal order'' of the Lcd D-Bus is curious. (only makes sense if your board GPIO pinout enabled fortuitous connection - via the ''tortured'' bus)
Many, many seek & enjoy the 4 GPIO pin savings when using 4 bits. And you have that working. For what good reason do you seek to ''kill'' this working system by moving to 8 bits?2012-12-18 05:19 AM
I have à new LCD(phico d-0 94v-0) wich must be configured in 8bits mode in order to write data.
i try with 4bits mode but no results http://www.datasheetarchive.com/LM2780A2C40HN-datasheet.html2012-12-18 08:57 AM
''i try with 4bits mode but no results.''
''No results'' as a diagnosis provides almost NO Value! Your new Lcd almost certainly includes an HD44780/clone control IC - and all of these are 4 or 8 bit compatible! Suspect instead that you have an improper contrast voltage (Vo) setting. If improper - you will not see the pixel field. It may be that you need some slight negative voltage on this Vo pin - devil in the detail w/in your data sheet.