用ATmega 16单片机驱动字符型液晶显示芯片

来源:本站
导读:目前正在解读《用ATmega 16单片机驱动字符型液晶显示芯片》的相关信息,《用ATmega 16单片机驱动字符型液晶显示芯片》是由用户自行发布的知识型内容!下面请观看由(电工技术网 - www.9ddd.net)用户发布《用ATmega 16单片机驱动字符型液晶显示芯片》的详细说明。
简介:研究了一下,如何用ATmega 16单片机,来驱动字符型液晶显示芯片,

研究了一下,如何用ATmega 16单片机,来驱动字符型液晶显示芯片,现把研究心得写出来:

我手里的这个RT1601液晶显示模块,使用的是S6A0069显示芯片。

各个引脚简单说明一下:

用ATmega 16单片机驱动字符型液晶显示芯片

控制和数据引脚配置如下:

-------------------------------

PORTD_0 -RS

PORTD_1 - R/W

PORTD_2 - E

PORTA - DATA BUS

------------------------------

LCD.h

1用ATmega 16单片机驱动字符型液晶显示芯片#ifndef_LCD_H_

2用ATmega 16单片机驱动字符型液晶显示芯片#define_LCD_H_

3用ATmega 16单片机驱动字符型液晶显示芯片/*****************************************

4用ATmega 16单片机驱动字符型液晶显示芯片RS-PORTD_0

5用ATmega 16单片机驱动字符型液晶显示芯片R/W-PORTD_1

6用ATmega 16单片机驱动字符型液晶显示芯片E-PORTD_2

7用ATmega 16单片机驱动字符型液晶显示芯片DB-PORTA

8用ATmega 16单片机驱动字符型液晶显示芯片******************************************/

9用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Set_RS(void);

10用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Clear_RS(void);

11用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Set_RW(void);

12用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Clear_RW(void);

13用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Set_E(void);

14用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Clear_E(void);

15用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_CheckBF(void);

16用ATmega 16单片机驱动字符型液晶显示芯片//WriteCommand

17用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Write_Cmd(unsignedcharbyCmd);

18用ATmega 16单片机驱动字符型液晶显示芯片//WriteData

19用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Write_Data(unsignedcharbyData);

20用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Delay_5ms(void);

21用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Delay_500ms(void);

22用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_PortInit(void);

23用ATmega 16单片机驱动字符型液晶显示芯片

24用ATmega 16单片机驱动字符型液晶显示芯片//ApplicaTIonInterface

25用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Init(void);

26用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Display(char*pstrText);

27用ATmega 16单片机驱动字符型液晶显示芯片

28用ATmega 16单片机驱动字符型液晶显示芯片#endif

29用ATmega 16单片机驱动字符型液晶显示芯片

LCD.c

这里是液晶驱动的实现部分,对外开放两个接口:LCD_Init, LCD_Display。(我这个模块,是两行显示的,共16个字符)

1用ATmega 16单片机驱动字符型液晶显示芯片#include“LCD.h”

2用ATmega 16单片机驱动字符型液晶显示芯片#include

3用ATmega 16单片机驱动字符型液晶显示芯片#include

4用ATmega 16单片机驱动字符型液晶显示芯片

5用ATmega 16单片机驱动字符型液晶显示芯片/*****************************************

6用ATmega 16单片机驱动字符型液晶显示芯片RS-PORTD_0

7用ATmega 16单片机驱动字符型液晶显示芯片R/W-PORTD_1

8用ATmega 16单片机驱动字符型液晶显示芯片E-PORTD_2

9用ATmega 16单片机驱动字符型液晶显示芯片DB-PORTA

10用ATmega 16单片机驱动字符型液晶显示芯片******************************************/

11用ATmega 16单片机驱动字符型液晶显示芯片

12用ATmega 16单片机驱动字符型液晶显示芯片

13用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Set_RS(void)

14用ATmega 16单片机驱动字符型液晶显示芯片{

15用ATmega 16单片机驱动字符型液晶显示芯片PORTD“=(1《《0);

16用ATmega 16单片机驱动字符型液晶显示芯片

17用ATmega 16单片机驱动字符型液晶显示芯片return;

18用ATmega 16单片机驱动字符型液晶显示芯片}

19用ATmega 16单片机驱动字符型液晶显示芯片

20用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Clear_RS(void)

21用ATmega 16单片机驱动字符型液晶显示芯片{

22用ATmega 16单片机驱动字符型液晶显示芯片PORTD&=~(1《《0);

23用ATmega 16单片机驱动字符型液晶显示芯片

24用ATmega 16单片机驱动字符型液晶显示芯片return;

25用ATmega 16单片机驱动字符型液晶显示芯片}

26用ATmega 16单片机驱动字符型液晶显示芯片

27用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Set_RW(void)

28用ATmega 16单片机驱动字符型液晶显示芯片{

29用ATmega 16单片机驱动字符型液晶显示芯片PORTD”=(1《《1);

30用ATmega 16单片机驱动字符型液晶显示芯片

31用ATmega 16单片机驱动字符型液晶显示芯片return;

32用ATmega 16单片机驱动字符型液晶显示芯片}

33用ATmega 16单片机驱动字符型液晶显示芯片

34用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Clear_RW(void)

35用ATmega 16单片机驱动字符型液晶显示芯片{

36用ATmega 16单片机驱动字符型液晶显示芯片PORTD&=~(1《《1);

37用ATmega 16单片机驱动字符型液晶显示芯片

38用ATmega 16单片机驱动字符型液晶显示芯片return;

39用ATmega 16单片机驱动字符型液晶显示芯片}

40用ATmega 16单片机驱动字符型液晶显示芯片

41用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Set_E(void)

42用ATmega 16单片机驱动字符型液晶显示芯片{

43用ATmega 16单片机驱动字符型液晶显示芯片PORTD“=(1《《2);

44用ATmega 16单片机驱动字符型液晶显示芯片

45用ATmega 16单片机驱动字符型液晶显示芯片return;

46用ATmega 16单片机驱动字符型液晶显示芯片}

47用ATmega 16单片机驱动字符型液晶显示芯片

48用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Clear_E(void)

49用ATmega 16单片机驱动字符型液晶显示芯片{

50用ATmega 16单片机驱动字符型液晶显示芯片PORTD&=~(1《《2);

51用ATmega 16单片机驱动字符型液晶显示芯片

52用ATmega 16单片机驱动字符型液晶显示芯片return;

53用ATmega 16单片机驱动字符型液晶显示芯片}

54用ATmega 16单片机驱动字符型液晶显示芯片

55用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_CheckBF(void)

56用ATmega 16单片机驱动字符型液晶显示芯片{

57用ATmega 16单片机驱动字符型液晶显示芯片DDRA=0x00;//Input

58用ATmega 16单片机驱动字符型液晶显示芯片

59用ATmega 16单片机驱动字符型液晶显示芯片LCD_Clear_RS();

60用ATmega 16单片机驱动字符型液晶显示芯片LCD_Set_RW();

61用ATmega 16单片机驱动字符型液晶显示芯片LCD_Set_E();

62用ATmega 16单片机驱动字符型液晶显示芯片while(PINA&0x80)

63用ATmega 16单片机驱动字符型液晶显示芯片{

64用ATmega 16单片机驱动字符型液晶显示芯片;

65用ATmega 16单片机驱动字符型液晶显示芯片}

66用ATmega 16单片机驱动字符型液晶显示芯片LCD_Clear_E();

67用ATmega 16单片机驱动字符型液晶显示芯片

68用ATmega 16单片机驱动字符型液晶显示芯片DDRA=0xFF;//Output

69用ATmega 16单片机驱动字符型液晶显示芯片

70用ATmega 16单片机驱动字符型液晶显示芯片return;

71用ATmega 16单片机驱动字符型液晶显示芯片}

72用ATmega 16单片机驱动字符型液晶显示芯片

73用ATmega 16单片机驱动字符型液晶显示芯片//WriteCommand

74用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Write_Cmd(unsignedcharbyCmd)

75用ATmega 16单片机驱动字符型液晶显示芯片{

76用ATmega 16单片机驱动字符型液晶显示芯片LCD_CheckBF();

77用ATmega 16单片机驱动字符型液晶显示芯片

78用ATmega 16单片机驱动字符型液晶显示芯片LCD_Clear_RS();

79用ATmega 16单片机驱动字符型液晶显示芯片LCD_Clear_RW();

80用ATmega 16单片机驱动字符型液晶显示芯片LCD_Set_E();

81用ATmega 16单片机驱动字符型液晶显示芯片PORTA=byCmd;

82用ATmega 16单片机驱动字符型液晶显示芯片LCD_Clear_E();

83用ATmega 16单片机驱动字符型液晶显示芯片

84用ATmega 16单片机驱动字符型液晶显示芯片return;

85用ATmega 16单片机驱动字符型液晶显示芯片}

86用ATmega 16单片机驱动字符型液晶显示芯片

87用ATmega 16单片机驱动字符型液晶显示芯片//WriteData

88用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Write_Data(unsignedcharbyData)

89用ATmega 16单片机驱动字符型液晶显示芯片{

90用ATmega 16单片机驱动字符型液晶显示芯片LCD_CheckBF();

91用ATmega 16单片机驱动字符型液晶显示芯片

92用ATmega 16单片机驱动字符型液晶显示芯片LCD_Set_RS();

93用ATmega 16单片机驱动字符型液晶显示芯片LCD_Clear_RW();

94用ATmega 16单片机驱动字符型液晶显示芯片LCD_Set_E();

95用ATmega 16单片机驱动字符型液晶显示芯片PORTA=byData;

96用ATmega 16单片机驱动字符型液晶显示芯片LCD_Clear_E();

97用ATmega 16单片机驱动字符型液晶显示芯片

98用ATmega 16单片机驱动字符型液晶显示芯片return;

99用ATmega 16单片机驱动字符型液晶显示芯片}

100用ATmega 16单片机驱动字符型液晶显示芯片

101用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Delay_5ms(void)

102用ATmega 16单片机驱动字符型液晶显示芯片{

103用ATmega 16单片机驱动字符型液晶显示芯片unsignedinTI=5552;

104用ATmega 16单片机驱动字符型液晶显示芯片while(i--)

105用ATmega 16单片机驱动字符型液晶显示芯片{

106用ATmega 16单片机驱动字符型液晶显示芯片;

107用ATmega 16单片机驱动字符型液晶显示芯片}

108用ATmega 16单片机驱动字符型液晶显示芯片

109用ATmega 16单片机驱动字符型液晶显示芯片return;

110用ATmega 16单片机驱动字符型液晶显示芯片}

111用ATmega 16单片机驱动字符型液晶显示芯片

112用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Delay_500ms(void)

113用ATmega 16单片机驱动字符型液晶显示芯片{

114用ATmega 16单片机驱动字符型液晶显示芯片unsignedchari=5;

115用ATmega 16单片机驱动字符型液晶显示芯片unsignedcharj=0;

116用ATmega 16单片机驱动字符型液晶显示芯片

117用ATmega 16单片机驱动字符型液晶显示芯片while(i--)

118用ATmega 16单片机驱动字符型液晶显示芯片{

119用ATmega 16单片机驱动字符型液晶显示芯片j=7269;

120用ATmega 16单片机驱动字符型液晶显示芯片while(j--)

121用ATmega 16单片机驱动字符型液晶显示芯片{

122用ATmega 16单片机驱动字符型液晶显示芯片;

123用ATmega 16单片机驱动字符型液晶显示芯片}

124用ATmega 16单片机驱动字符型液晶显示芯片}

125用ATmega 16单片机驱动字符型液晶显示芯片

126用ATmega 16单片机驱动字符型液晶显示芯片return;

127用ATmega 16单片机驱动字符型液晶显示芯片}

128用ATmega 16单片机驱动字符型液晶显示芯片

129用ATmega 16单片机驱动字符型液晶显示芯片//PorTInit

130用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_PorTInit(void)

131用ATmega 16单片机驱动字符型液晶显示芯片{

132用ATmega 16单片机驱动字符型液晶显示芯片PORTD=0x00;

133用ATmega 16单片机驱动字符型液晶显示芯片DDRD=0xFF;//Output

134用ATmega 16单片机驱动字符型液晶显示芯片DDRA=0xFF;

135用ATmega 16单片机驱动字符型液晶显示芯片

136用ATmega 16单片机驱动字符型液晶显示芯片return;

137用ATmega 16单片机驱动字符型液晶显示芯片}

138用ATmega 16单片机驱动字符型液晶显示芯片

139用ATmega 16单片机驱动字符型液晶显示芯片//LCDInit

140用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Init(void)

141用ATmega 16单片机驱动字符型液晶显示芯片{

142用ATmega 16单片机驱动字符型液晶显示芯片LCD_PortInit();

143用ATmega 16单片机驱动字符型液晶显示芯片

144用ATmega 16单片机驱动字符型液晶显示芯片LCD_Delay_500ms();

145用ATmega 16单片机驱动字符型液晶显示芯片

146用ATmega 16单片机驱动字符型液晶显示芯片LCD_Write_Cmd(0x38);//FunctionSet.8bitdatalength,2-line,5*8font

147用ATmega 16单片机驱动字符型液晶显示芯片LCD_Delay_5ms();

148用ATmega 16单片机驱动字符型液晶显示芯片LCD_Write_Cmd(0x0C);//DisplayON/OFFControl.DisplayON,CursorOFF,BlinkOFF

149用ATmega 16单片机驱动字符型液晶显示芯片LCD_Delay_5ms();

150用ATmega 16单片机驱动字符型液晶显示芯片LCD_Write_Cmd(0x01);//DisplayClear.

151用ATmega 16单片机驱动字符型液晶显示芯片LCD_Delay_5ms();

152用ATmega 16单片机驱动字符型液晶显示芯片LCD_Write_Cmd(0x06);//EntryModeSet.Incrementmode,Entireshiftoff

153用ATmega 16单片机驱动字符型液晶显示芯片

154用ATmega 16单片机驱动字符型液晶显示芯片return;

155用ATmega 16单片机驱动字符型液晶显示芯片}

156用ATmega 16单片机驱动字符型液晶显示芯片

157用ATmega 16单片机驱动字符型液晶显示芯片voidLCD_Display(char*pstrText)

158用ATmega 16单片机驱动字符型液晶显示芯片{

159用ATmega 16单片机驱动字符型液晶显示芯片unsignedchari=0;

160用ATmega 16单片机驱动字符型液晶显示芯片

161用ATmega 16单片机驱动字符型液晶显示芯片LCD_Write_Cmd(0x80”0x00);//1LinePosition

162用ATmega 16单片机驱动字符型液晶显示芯片while(*pstrText!=0x00)

163用ATmega 16单片机驱动字符型液晶显示芯片{

164用ATmega 16单片机驱动字符型液晶显示芯片if(i==8)

165用ATmega 16单片机驱动字符型液晶显示芯片{

166用ATmega 16单片机驱动字符型液晶显示芯片LCD_Write_Cmd(0x80“0x40);//2LinePosition

167用ATmega 16单片机驱动字符型液晶显示芯片}

168用ATmega 16单片机驱动字符型液晶显示芯片

169用ATmega 16单片机驱动字符型液晶显示芯片LCD_Write_Data(*(pstrText++));

170用ATmega 16单片机驱动字符型液晶显示芯片i++;

171用ATmega 16单片机驱动字符型液晶显示芯片}

172用ATmega 16单片机驱动字符型液晶显示芯片

173用ATmega 16单片机驱动字符型液晶显示芯片return;

174用ATmega 16单片机驱动字符型液晶显示芯片}

175用ATmega 16单片机驱动字符型液晶显示芯片

176用ATmega 16单片机驱动字符型液晶显示芯片

client端调用如下:

1用ATmega 16单片机驱动字符型液晶显示芯片//ICC-AVRapplicationbuilder:2008-6-48:41:19

2用ATmega 16单片机驱动字符型液晶显示芯片//Target:M16

3用ATmega 16单片机驱动字符型液晶显示芯片//Crystal:4.0000Mhz

4用ATmega 16单片机驱动字符型液晶显示芯片#include

5用ATmega 16单片机驱动字符型液晶显示芯片#include

6用ATmega 16单片机驱动字符型液晶显示芯片#include”LCD.h“

7用ATmega 16单片机驱动字符型液晶显示芯片

8用ATmega 16单片机驱动字符型液晶显示芯片voidmain(void)

9用ATmega 16单片机驱动字符型液晶显示芯片{

10用ATmega 16单片机驱动字符型液晶显示芯片LCD_Init();

11用ATmega 16单片机驱动字符型液晶显示芯片LCD_Display(”RT1601DemobyWF“);

12用ATmega 16单片机驱动字符型液晶显示芯片

13用ATmega 16单片机驱动字符型液晶显示芯片while(1)

14用ATmega 16单片机驱动字符型液晶显示芯片{

15用ATmega 16单片机驱动字符型液晶显示芯片;

16用ATmega 16单片机驱动字符型液晶显示芯片}

17用ATmega 16单片机驱动字符型液晶显示芯片

18用ATmega 16单片机驱动字符型液晶显示芯片return;

19用ATmega 16单片机驱动字符型液晶显示芯片}

提醒:《用ATmega 16单片机驱动字符型液晶显示芯片》最后刷新时间 2024-03-14 01:07:14,本站为公益型个人网站,仅供个人学习和记录信息,不进行任何商业性质的盈利。如果内容、图片资源失效或内容涉及侵权,请反馈至,我们会及时处理。本站只保证内容的可读性,无法保证真实性,《用ATmega 16单片机驱动字符型液晶显示芯片》该内容的真实性请自行鉴别。