HAL_LCD_Lampex.rar

  • PUDN用户
    了解作者
  • C/C++
    开发工具
  • 1KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 13
    下载次数
  • 2010-03-01 22:24
    上传日期
Lampex LCD Interface
HAL_LCD_Lampex.rar
  • HAL_LCD_Lampex.c
    5.2KB
内容介绍
#ifndef LCD_LAMPEX #define LCD_LAMPEX #include <ioCC2430.h> #include "ZComDef.h" #define NOP_ asm("NOP") char MES1[16]= "TIME : : "; // LCD DISPLAY MESSAGE char MES2[16]= " / /20 "; // LCD DISPLAY MESSAGE void LCD_INIT(void); void LCD_PortInit(void); void En_High(void); void Rs_Low(void); void Rs_High(void); void En_Pulse(void); void Delay_ms(unsigned int MS_Cnt); void Delay_us(unsigned int US_Cnt); void Clear_Disp(void); void Display_char(char LCD_char); void Display_Str(char MESSAGE[16], unsigned int Line_No,int No_of_Char); void Set_Display_Line(unsigned char LineNo); void Display_Int(uint16 Int_val); void Delay_ms(unsigned int MS_Cnt) { unsigned int mscnt; for(mscnt=0;mscnt<MS_Cnt;mscnt++) { Delay_us(1000); } } void Delay_us(unsigned int US_Cnt) { while(US_Cnt--); } void LCD_PortInit(void) { ADCCFG = 0x00; P0SEL = 0x00; //Select P0.6 & 7 as GPIO's P0DIR = 0xFF; //P0.6 & 7 as Output P2SEL &= 0xF0; //Select P2.0-3 as GPIO's P2DIR |= 0x0F; //P2.0-3 as Output } void En_High(void){ P0_5 = 1; } void Rs_Low(void){ P2_0 = 0; } void Rs_High(void){ P2_0 = 1; } void En_Pulse(void){ P0_5 = 0; NOP_; P0_5 = 1; } void Clear_Disp(void){ P0 &= 0xE1; //LCD_Data=0x01 En_Pulse(); P0 |= 0x02; En_Pulse(); Delay_us(5); } void LCD_INIT(void){ char ii; /* LCD INITILIZATION */ LCD_PortInit(); En_High(); Rs_Low(); Delay_us(30); // P1 &= 0xE1; ////LCD_Data=0x03 // P1 |= 0x04; En_Pulse(); Delay_us(30); P0 &= 0xE1; //LCD_Data=0x02 P0 |= 0x04; En_Pulse(); Delay_us(30); P0 &= 0xE1; //LCD_Data=0x02 P0 |= 0x04; En_Pulse(); P0 &= 0xE1; ////LCD_Data=0x08 P0 |= 0x10; En_Pulse(); Delay_us(30); P0 &= 0xE1; //LCD_Data=0x02 P0 |= 0x04; En_Pulse(); P0 &= 0xE1; ////LCD_Data=0x08 P0 |= 0x10; En_Pulse(); Delay_us(30); P0 &= 0xE1; //LCD_Data=0x01 P0 |= 0x02; En_Pulse(); P0 &= 0xE1; //LCD_Data=0x04 P0 |= 0x08; En_Pulse(); Delay_us(30); P0 &= 0xE1; //LCD_Data=0x00 En_Pulse(); P0 &= 0xE1; //LCD_Data=0x06 P0 |= 0x0C; En_Pulse(); Delay_us(200); P0 &= 0xE1; //LCD_Data=0x00 En_Pulse(); P0 &= 0xE1; //LCD_Data=0x0F P0 |= 0x1E; En_Pulse(); Delay_us(30); for(ii=0;ii<=2;ii++) NOP_;/* END OF LCD INITILIZATION */ } void Display_Str(char MESSAGE[16], unsigned int Line_No,int No_of_Char) { int i; unsigned char LCD_Data_HN,LCD_Data_LN; Delay_us(30); Rs_Low(); // Make Rs pin low LCD_Data_HN = (Line_No >> 4) & 0x0F; LCD_Data_HN <<= 1; LCD_Data_HN |= 0x20; LCD_Data_LN = Line_No & 0x0F; LCD_Data_LN <<=1; LCD_Data_LN |= 0x20; P0 = LCD_Data_HN; En_Pulse(); P0 = LCD_Data_LN; En_Pulse(); // Give Enable Pulse to LCD. Delay_us(200); Rs_High(); // Make Rs pin high (Data mode) /*;-------------------------------------------------------*/ for(i=0;i<No_of_Char;i++) { if(MESSAGE[i]<0x20) MESSAGE[i] = 0x20; LCD_Data_HN = (MESSAGE[i] >> 4) & 0x0F; LCD_Data_HN <<= 1; LCD_Data_HN |= 0x20; LCD_Data_LN = MESSAGE[i] & 0x0F; LCD_Data_LN <<=1; LCD_Data_LN |= 0x20; P0 = LCD_Data_HN; En_Pulse(); P0 = LCD_Data_LN; /* LCD_Data = 0; LCD_Data = (MESSAGE[i] >> 4) & 0x0F; LCD_Data <<= 1; P0 |= LCD_Data; LCD_Data |= 0xE1; P0 &= LCD_Data; En_Pulse(); LCD_Data = 0; LCD_Data = MESSAGE[i] & 0x0F; LCD_Data <<= 1; P0 |= LCD_Data; LCD_Data |= 0xE1; P0 &= LCD_Data; */ En_Pulse(); // Give Enable Pulse to LCD. Delay_us(100); } Rs_Low(); } void Display_char(char LCD_char) { unsigned char LCD_Data_HN,LCD_Data_LN; Rs_High(); // Make Rs pin high (Data mode) if(LCD_char<0x20) LCD_char += 0x30; LCD_Data_HN = (LCD_char >> 4) & 0x0F; LCD_Data_HN <<= 1; LCD_Data_HN |= 0x20; LCD_Data_LN = LCD_char & 0x0F; LCD_Data_LN <<=1; LCD_Data_LN |= 0x20; P0 = LCD_Data_HN; En_Pulse(); P0 = LCD_Data_LN; En_Pulse(); // Give Enable Pulse to LCD. Delay_us(300); Rs_Low(); } void Set_Display_Line(unsigned char LineNo) { unsigned char LCD_Data_HN,LCD_Data_LN; Delay_us(30); Rs_Low(); // Make Rs pin low LCD_Data_HN = (LineNo >> 4) & 0x0F; LCD_Data_HN <<= 1; LCD_Data_HN |= 0x20; LCD_Data_LN = LineNo & 0x0F; LCD_Data_LN <<=1; LCD_Data_LN |= 0x20; P0 = LCD_Data_HN; En_Pulse(); P0 = LCD_Data_LN; En_Pulse(); // Give Enable Pulse to LCD. } void Display_Int(uint16 Int_val) { uint16 lcdtemp; uint8 DispSr[5],cntr; lcdtemp = Int_val; cntr = 0; while(cntr < 5) { DispSr[cntr] = 0x20; cntr++; } while (lcdtemp) { DispSr[cntr-1] = (lcdtemp%10)+0x30; lcdtemp /= 10; cntr --; } cntr = 0; while(cntr < 5) { Display_char(DispSr[cntr]); cntr ++; } } #endif
评论
    相关推荐
    • fsmc_lcd.zip
      使用stm32cubemx设置了相关寄存器并成功驱动了探索者F4开发板的液晶屏。
    • stm32f207vct6_HAL_ ILI9325_FSMC.rar
      stm32f207 drive LCD ILI9325 , config with cubemx and HAL, LCD interface with FSMC
    • hal_lcd.rar
      LC12864的驱动文件,适用于CC2530,经过调试验证。
    • hal_lcd.zip
      液晶屏128X64驱动,支持Z-TACK里面的LCD驱动。
    • hal_lcd.rar
      学习Ble协议栈,CC254xEK板子上的lcd驱动编写
    • hal_lcd.rar
      zigbee 的LCD显示代码,对没有lcd显示的应用有很大帮助
    • IIC_LCD1602 STM32-HAL驱动程序-硬件IIC
      STM32F103C8T6驱动LCD(带PCF8574转接板,IIC驱动),利用CUBEMAX生成,HAL库硬件IIC.
    • python_lcd-master.zip
      lcd_api和i2c_lcd 用于与HD44780兼容的基于字符的点阵LCD对话的Python代码。 其他港口 此代码是同步的。 Peter Hinch在为HD77480集成了一个异步驱动程序。 该库基于我编写的C版本,可以在找到(也可以在同一目录中...
    • STM32f103_HAL_2020.zip
      STM32官网,2020/8/8下载,转载此处方便大家学习。 列举了HAL库下的各个函数用法及外设驱动,网上搜的旧版有的已经匹配不上cubemax生成的工程了。学习F1/F4系列都可以参考,大同小异。
    • Proteus7.12.rar
      Proteus7.12完美破解版.rar电路仿真软件很好用可以仿真单片数字模拟电路