HD44780U-based LCD Example

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

HD44780U-based LCD Example

ソリューションへジャンプ
2,521件の閲覧回数
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,262件の閲覧回数
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,263件の閲覧回数
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,261件の閲覧回数
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,261件の閲覧回数
rayhall
Contributor V

Ladislav,

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

Ray.

0 件の賞賛
返信