LCD Hitachi HD44780 H9s12

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

LCD Hitachi HD44780 H9s12

3,476 次查看
fekt
Contributor I
Hello I need connesct LCD Hitachi HD44780 to HC9S12DP256. I find this source code, but it is customized for somethig AVR. There is addres from external RAM to port A and C. I don't know i can addres from externam RAM for HC9S12dp256. Thank you many for help and i am so sorry for my english. #include "hidef.h" #include "mc9s12dp256.h" #include "lcdd.h" #pragma LINK_INFO DERIVATIVE "mc9s12dp256b" void vInitLcd(void); void vDispIReset(void); void vClearLcd(void); void vDelay(unsigned int uiTime_us); void vPutCharToLcd( char cData, char cRs); void vDisplayBusy(void); #define LCD_8BIT 0x38 #define LCD_OFF 0x0C #define LCD_INKR 0x06 #define LCD_CLEAR 0x01 #define LCD_RS_CTRL 0 #define LCD_RS_DATA 1 #define LCD_DATA_REG (*(unsigned char*)(0xC000)) /*DATA REGISTER*/ #define LCD_CTRL_REG (*(unsigned char*)(0x8000)) /*CTRL REGISTER*/ char InfoTextL1[] = "Ondra"; char InfoTextL2[] = "ondra"; void main(void) { /* put your own code here */ unsigned char ucIndex = 0; unsigned char i = 0; EnableInterrupts; vInitLcd(); vClearLcd(); for(;:smileywink: { ucIndex = 0; do{ DisplayBusy(); vPutCharToLcd(InfoTextL1[ucIndex], LCD_RS_DATA); ++ucIndex; vDelay(65000); }while(ucIndex 20); ucIndex = 0; do{ vDislayBusy(); vPutCharToLcd(InfoTextL2[ucIndex], LCD_RS_DATA); ++ucIndex; }while(ucIndex 20); vDelay(65000); for(i=0; i10;i++){ vDelay(65000); } vClearLcd(); } /* wait forever */ /* please make sure that you never leave this function */ } void vInitLcd(void){ MCUCR |=0x80; MCUCR |=0x40; vDisplReset(); } void vDisplReset(void){ vDelay(15000); vPutCharToLcd(LCD_8BIT, LCD_RS_CTRL); vDelay(4100) ; vPutCharToLcd(LCD_8BIT, LCD_RS_CTRL); vDelay(100); vPutCharToLcd(LCD_8BIT, LCD_RS_CTRL); vDelay(100); vPutCharToLcd(LCD_8BIT, LCD_RS_CTRL); vDelay(100); vPutCharToLcd(LCD_OFF, LCD_RS_CTRL); vDelay(100); vPutCharToLcd(LCD_INKR, LCD_RS_CTRL); vDelay(100); } void vPutCharToLcd(char cData, char cRs){ if(cRs) LCD_DATA_REG = cData; else LCD_CTRL_REG = cData; } void vClearLcd(void){ vPutCharToLcd(LCD_CLEAR, LCD_RS_CTRL); vDelay(1640); } void vDelay(unsigned int uiTime_us){ uiTime_us /=17; uiTime_us *=10; while(--uiTime_us); } void vDisplayBusy(void){ unsigned char ucBusy; do{ ucBusy = LCD_CTRL_REG; }while(ucBusy & 0x80); }
标签 (1)
0 项奖励
回复
3 回复数

845 次查看
JimDon
Senior Contributor III
Something went wrong. I can't read this. Please repost.

Here is some lcd code that might help. Scroll down the page to the samples part, look near the end of the list.
This is for a Dragon12, but you might find it useful.


Message Edited by JimDon on 2008-02-27 06:00 PM
0 项奖励
回复

845 次查看
fekt
Contributor I
Yes this is exactly, what i need. Thank you very much
0 项奖励
回复

845 次查看
zeb
Contributor I
 
There is a more better approach  to interface with  LCD is by SPI  port and shift register.
 
LCD ( 4-bit mode) is  interfaced with  74HC595 8-bit shift  register &  9S12 MCU  send  commands &  data via  SPI port to shift register..
 
This more easy and  better approach  than parallel approach.
 
This method  is described in  The HCS12/9S12, An Introduction to Hardware & Software Engineering  by Fredrick M. Cady.
 
This topic is disccused at
 
 
I use this method with SPI baud rate 12.5Mhz. This run better.
 
Good Luck
 
Mian Ahmed Jehanzeb
0 项奖励
回复