HD44780U-based LCD Example

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

HD44780U-based LCD Example

跳至解决方案
2,547 次查看
rayhall
Contributor V

Hello,

 

I am looking for code to drive HD44780U-based 16x 2 LCD display. I am not using Processor Expert.

 

I have a working example for the Atmel AVR, but not sure it can be converted to suit the S12XE I am using.

 

Ray.

标签 (1)
0 项奖励
回复
1 解答
2,288 次查看
lama
NXP TechSupport
NXP TechSupport

Hi,

Attached project is for Dp256 and older version CodeWarrior but I think easy portable.

i did it a looooooooong time ago.

You will need to adjust:

static void LcdDelay10ms (void);

static void LcdDelay1us             (void);

in the LCD_HD44780.c file

The best way is to use simulator to adjust timing to given BUSCLK or you can use another approach to generate these delays in the LCD_HD44780.c file (for example PIT).

...and if you use following functions in the main.c then you should also adjust them on the basis of the BUSCLK you use.

void  delay10ms         (void);

void  delay1_4s         (void);

void  delay2s           (void);

Entire system setup is done in the LCD_HD44780.h

If you do not understand anything do not hesitate to ask.

If I have a little bit more time this week I can adjust the SW for your reqs but I need to know:

BUSCLK, 8 or 4 bit data bus and which port pins, you want only to write or also read from display, define control at MCU pins for E, RW and RS of the display.

Usage of roll up/down/left/right requires also enabling roll functions if you do not it perform it in your mirror window in the MCU's memory and you just refreshes display in .

If this answer solves your issue please label it as answered to provide easier search to other users.

Best regards,

Ladislav

在原帖中查看解决方案

0 项奖励
回复
3 回复数
2,289 次查看
lama
NXP TechSupport
NXP TechSupport

Hi,

Attached project is for Dp256 and older version CodeWarrior but I think easy portable.

i did it a looooooooong time ago.

You will need to adjust:

static void LcdDelay10ms (void);

static void LcdDelay1us             (void);

in the LCD_HD44780.c file

The best way is to use simulator to adjust timing to given BUSCLK or you can use another approach to generate these delays in the LCD_HD44780.c file (for example PIT).

...and if you use following functions in the main.c then you should also adjust them on the basis of the BUSCLK you use.

void  delay10ms         (void);

void  delay1_4s         (void);

void  delay2s           (void);

Entire system setup is done in the LCD_HD44780.h

If you do not understand anything do not hesitate to ask.

If I have a little bit more time this week I can adjust the SW for your reqs but I need to know:

BUSCLK, 8 or 4 bit data bus and which port pins, you want only to write or also read from display, define control at MCU pins for E, RW and RS of the display.

Usage of roll up/down/left/right requires also enabling roll functions if you do not it perform it in your mirror window in the MCU's memory and you just refreshes display in .

If this answer solves your issue please label it as answered to provide easier search to other users.

Best regards,

Ladislav

0 项奖励
回复
2,287 次查看
rayhall
Contributor V

Ladislav,

I am now ready to use the driver. I am unsure how to set these. I do not understand the pin names. Example PTM_PTM5. I would have expected pin names like PORTC_PC0 and PORTC for the display port name. 

/**************************************************************************/

   /* LCD HARDWARE CONTROL PORTS                                             */

   /**************************************************************************/

   #define     LCD_E           PTM_PTM5  /* disp ENABLE pin                 */

   #define     LCD_RW          PTM_PTM6  /* disp R/W pin (write/read = 1/0) */

   #define     LCD_RS          PTM_PTM7  /* disp RS pin  (data/ctrl  = 1/0) */

   #define     LCD_DE          DDRM_DDRM5 /* disp ENABLE pin direction bit   */

   #define     LCD_DRW         DDRM_DDRM6 /* disp R/W pin direction bit      */

   #define     LCD_DRS         DDRM_DDRM7 /* disp RS pin direction bit       */  

   #define     LCD_DPORT       PTP    /* display data port               */

   #define     LCD_DPORTDIR    DDRP   /* display data port direction re- */

                                                 /*gister address                   */ 

   #define     LCD_FBUS        50                 /* uC bus frequency [MHz](necessary */

                                                 /* to ensure software delays)       */

Ray.

0 项奖励
回复
2,287 次查看
rayhall
Contributor V

Ladislav,

Thank you for the driver code. I will try it in about a weeks time.

Ray.

0 项奖励
回复