首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >变形杆菌在液晶显示器( LM015L )上显示字符

变形杆菌在液晶显示器( LM015L )上显示字符
EN

Stack Overflow用户
提问于 2022-05-20 14:16:39
回答 1查看 57关注 0票数 0

我一直试图在LCD ( LM015L )上展示一些人物,但我没能做到。

我用c语言编写了以下代码:

代码语言:javascript
运行
复制
// LCD module connections
sbit LCD_RS at LATD0_bit;
sbit LCD_EN at LATD1_bit;
sbit LCD_D4 at LATD2_bit;
sbit LCD_D5 at LATD3_bit;
sbit LCD_D6 at LATD4_bit;
sbit LCD_D7 at LATD5_bit;

sbit LCD_RS_Direction at TRISD0_bit;
sbit LCD_EN_Direction at TRISD1_bit;
sbit LCD_D4_Direction at TRISD2_bit;
sbit LCD_D5_Direction at TRISD3_bit;
sbit LCD_D6_Direction at TRISD4_bit;
sbit LCD_D7_Direction at TRISD5_bit;
// End LCD module connections


void main() {

 Lcd_Init(); // Initialize LCD
 Lcd_Cmd(_LCD_CLEAR); // Clear display
 Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

 Lcd_Out(1, 1, "microcontrollers"); // Display "StudentCompanion"
 Lcd_Out(2, 1, "lab.com"); // Display "Thermometer"

}

我在proteus中设计了以下方案

在我运行模拟之后,LCD打开了,上面没有显示任何内容。

EN

回答 1

Stack Overflow用户

发布于 2022-05-30 07:07:45

由于PORTD引脚与模拟硬件多路复用,因此您应该手动禁用模拟输入。这是您的代码中缺少的内容。注意,每次对PIC进行重置时,端口的默认输入函数都是模拟输入。

代码语言:javascript
运行
复制
/ LCD module connections
sbit LCD_RS at LATD0_bit;
sbit LCD_EN at LATD1_bit;
sbit LCD_D4 at LATD2_bit;
sbit LCD_D5 at LATD3_bit;
sbit LCD_D6 at LATD4_bit;
sbit LCD_D7 at LATD5_bit;

sbit LCD_RS_Direction at TRISD0_bit;
sbit LCD_EN_Direction at TRISD1_bit;
sbit LCD_D4_Direction at TRISD2_bit;
sbit LCD_D5_Direction at TRISD3_bit;
sbit LCD_D6_Direction at TRISD4_bit;
sbit LCD_D7_Direction at TRISD5_bit;
// End LCD module connections


void main() {
 // The library only configures the direction of pins but not the analog functions. So you must do it before initializing the LCD module.
 ANSELD = 0; // Disable analog functions on PORTD

 Lcd_Init(); // Initialize LCD
 Lcd_Cmd(_LCD_CLEAR); // Clear display
 Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

 Lcd_Out(1, 1, "microcontrollers"); // Display "StudentCompanion"
 Lcd_Out(2, 1, "lab.com"); // Display "Thermometer"

}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72320434

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档