完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,我正在做一个我想使用16x2液晶显示器的项目。我在网上找到了一些代码,并改变了PIC18F25K40微控制器(可能是坏的)。MyPLAB IPE V4.10将十六进制写入微控制器,但在液晶显示器上什么也没有发生。我把所有东西都放在一个电路板上,我刚刚创建了一个proteus项目,向您展示它是如何连接的。我使用的是XC8 V1.45编译器。我想请你帮我找出我做错了什么。一切都在附件里。谢谢!
以上来自于百度翻译 以下为原文 Hello, I'm woking on a project where I want to use 16x2 LCD. I found some codes on internet and changed it (maybe badly) for PIC18F25K40 microcontroller. The MPLAB IPE v4.10 writes the hex to the microcontroller, but nothing happens wtih the LCD. I have everything on a breadboard, I just created a Proteus project to show you how it is circa connected. I'm using XC8 V1.45 Compiler. I want to ask you to help me find what I am doing wrong. Everything is in the attachment. Thank You! Attachment(s) lcd.X.zip (332.97 KB) - downloaded 28 times |
|
相关推荐
14个回答
|
|
K40系列PIC的早期修订对NVMRG控制位的正确设置有问题,编译器中有一个勘误设置来纠正这个错误。你应用了ErATA设置吗?(NVMRG+)
以上来自于百度翻译 以下为原文 Early revisions of the K40 series of pics have an issue with the proper setting of the nvmreg control bits, there is an errata setting in the compiler to correct this. Have you applied the erata setting? (nvmreg+) |
|
|
|
谢谢你的回答,我在哪里或者怎样应用这个设置,我找不到它。
以上来自于百度翻译 以下为原文 Thanks for your answer, Where or how can I apply that setting, I can't find it. |
|
|
|
在XC8文档文件夹中读取“Read MexC8. HTM”。
以上来自于百度翻译 以下为原文 Read the "Readme_XC8.htm" in the XC8 docs folder. |
|
|
|
在MPLABX:Project Projt&G.XC8连接器(GT);附加选项& Grand;N+MVReg
以上来自于百度翻译 以下为原文 in MPLABX: project properties>XC8 Linker>additional options>Errata>+nvmreg |
|
|
|
对不起,我很笨。我不知道该怎么做。我写了勘误表,但什么也没做。
以上来自于百度翻译 以下为原文 Sorry I'm stupid in it. I don't know how to do that. I wrote there ERRATA, but it didn't do anything. Attached Image(s) |
|
|
|
你误解了“附加选项”,这是另一个下拉。当你选择它时,你会看到一个名为“ErrATA”的设置,这就是你放置“+NVMReg”的地方。
以上来自于百度翻译 以下为原文 You mis-interpreted "additional options", it is another dropdown up the top. When you select it, you will see a setting called "ERRATA" and that is where you put "+nvmreg". |
|
|
|
谢谢,但是我在LCD上还没有任何东西。还有其他设置我必须设置?
以上来自于百度翻译 以下为原文 Thank you, but I still haven't got anything on the LCD. Are there other setting that I have to set? |
|
|
|
我认为你需要设置安塞尔=0。
以上来自于百度翻译 以下为原文 I think you need to set ANSELC = 0. #define _XTAL_FREQ 64000000 #define RS RC2 #define EN RC3 #define D4 RC4 #define D5 RC5 #define D6 RC6 #define D7 RC7 #include #include "lcd.h" // PIC18F25K40 Configuration Bit Settings // 'C' source line config statements // CONFIG1L #pragma config FEXTOSC = OFF // External Oscillator mode Selection bits (Oscillator not enabled) #pragma config RSTOSC = HFINTOSC_64MHZ// Power-up default value for COSC bits (HFINTOSC with HFFRQ = 64 MHz and CDIV = 1:1) // CONFIG1H #pragma config CLKOUTEN = OFF // Clock Out Enable bit (CLKOUT function is disabled) #pragma config CSWEN = ON // Clock Switch Enable bit (Writing to NOSC and NDIV is allowed) #pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor enabled) // CONFIG2L #pragma config MCLRE = EXTMCLR // Master Clear Enable bit (If LVP = 0, MCLR pin is MCLR; If LVP = 1, RE3 pin function is MCLR ) #pragma config PWRTE = OFF // Power-up Timer Enable bit (Power up timer disabled) #pragma config LPBOREN = OFF // Low-power BOR enable bit (ULPBOR disabled) #pragma config BOREN = SBORDIS // Brown-out Reset Enable bits (Brown-out Reset enabled , SBOREN bit is ignored) // CONFIG2H #pragma config BORV = VBOR_2P45 // Brown Out Reset Voltage selection bits (Brown-out Reset Voltage (VBOR) set to 2.45V) #pragma config ZCD = OFF // ZCD Disable bit (ZCD disabled. ZCD can be enabled by setting the ZCDSEN bit of ZCDCON) #pragma config PPS1WAY = ON // PPSLOCK bit One-Way Set Enable bit (PPSLOCK bit can be cleared and set only once; PPS registers remain locked after one clear/set cycle) #pragma config STVREN = ON // Stack Full/Underflow Reset Enable bit (Stack full/underflow will cause Reset) #pragma config DEBUG = OFF // Debugger Enable bit (Background debugger disabled) #pragma config XINST = OFF // Extended Instruction Set Enable bit (Extended Instruction Set and Indexed Addressing Mode disabled) // CONFIG3L #pragma config WDTCPS = WDTCPS_31// WDT Period Select bits (Divider ratio 1:65536; software control of WDTPS) #pragma config WDTE = ON // WDT operating mode (WDT enabled regardless of sleep) // CONFIG3H #pragma config WDTCWS = WDTCWS_7// WDT Window Select bits (window always open (100%); software control; keyed access not required) #pragma config WDTCCS = SC // WDT input clock selector (Software Control) // CONFIG4L #pragma config WRT0 = OFF // Write Protection Block 0 (Block 0 (000800-001FFFh) not write-protected) #pragma config WRT1 = OFF // Write Protection Block 1 (Block 1 (002000-003FFFh) not write-protected) #pragma config WRT2 = OFF // Write Protection Block 2 (Block 2 (004000-005FFFh) not write-protected) #pragma config WRT3 = OFF // Write Protection Block 3 (Block 3 (006000-007FFFh) not write-protected) // CONFIG4H #pragma config WRTC = OFF // Configuration Register Write Protection bit (Configuration registers (300000-30000Bh) not write-protected) #pragma config WRTB = OFF // Boot Block Write Protection bit (Boot Block (000000-0007FFh) not write-protected) #pragma config WRTD = OFF // Data EEPROM Write Protection bit (Data EEPROM not write-protected) #pragma config SCANE = ON // Scanner Enable bit (Scanner module is available for use, SCANMD bit can control the module) #pragma config LVP = OFF // Low Voltage Programming Enable bit (HV on MCLR/VPP must be used for programming) // CONFIG5L #pragma config CP = OFF // UserNVM Program Memory Code Protection bit (UserNVM code protection disabled) #pragma config CPD = OFF // DataNVM Memory Code Protection bit (DataNVM code protection disabled) // CONFIG5H // CONFIG6L #pragma config EBTR0 = OFF // Table Read Protection Block 0 (Block 0 (000800-001FFFh) not protected from table reads executed in other blocks) #pragma config EBTR1 = OFF // Table Read Protection Block 1 (Block 1 (002000-003FFFh) not protected from table reads executed in other blocks) #pragma config EBTR2 = OFF // Table Read Protection Block 2 (Block 2 (004000-005FFFh) not protected from table reads executed in other blocks) #pragma config EBTR3 = OFF // Table Read Protection Block 3 (Block 3 (006000-007FFFh) not protected from table reads executed in other blocks) // CONFIG6H #pragma config EBTRB = OFF // Boot Block Table Read Protection bit (Boot Block (000000-0007FFh) not protected from table reads executed in other blocks) // #pragma config statements should precede project file includes. // Use project enums instead of #define for ON and OFF. int main() { unsigned int a; TRISC = 0x00; Lcd_Init(); while(1) { Lcd_Clear(); Lcd_Set_Cursor(1,1); Lcd_Write_String("LCD Library for"); Lcd_Set_Cursor(2,1); Lcd_Write_String("MPLAB XC8"); __delay_ms(2000); Lcd_Clear(); Lcd_Set_Cursor(1,1); Lcd_Write_String("Developed By"); Lcd_Set_Cursor(2,1); Lcd_Write_String("electroSome"); __delay_ms(2000); Lcd_Clear(); Lcd_Set_Cursor(1,1); Lcd_Write_String("www.electroSome.com"); for(a=0;a<15;a++) { __delay_ms(300); Lcd_Shift_Left(); } for(a=0;a<15;a++) { __delay_ms(300); Lcd_Shift_Right(); } Lcd_Clear(); Lcd_Set_Cursor(2,1); Lcd_Write_Cha r('e'); // remove space Lcd_Write_Cha r('S'); // same here - forum software is scared of shady karacters ;) __delay_ms(2000); } return 0; } |
|
|
|
谢谢,但还是一样的。我不明白为什么它不起作用。我看了一百个教程,什么都没有。
以上来自于百度翻译 以下为原文 Thanks, but it is the same. I don't understand why it is not working. I watched hundred tutorials and nothing.. |
|
|
|
我认为你需要退后一步,用更简单的步骤来解决这个问题。你的电路的艺术是什么,而不是。更具体,更多细节。图片是在运行吗?你正在向LCD发出信号吗?它们是正确的吗?把问题分解成更简单的步骤,按顺序检查每一步。
以上来自于百度翻译 以下为原文 I think you need to step back and approach this in simpler steps. What arts of your circuit work, which don't. Be more specific, more details. Is the pic runing? Are you getting signals to the LCD? Are they correct? Break the problem down to simpler steps and check each step in order. |
|
|
|
对于你的键盘设置和Proteus,你有相同的结果吗?
以上来自于百度翻译 以下为原文 Do you have same same results for both your breadboard setup AND for Proteus ? |
|
|
|
|
|
|
|
可能的RMW问题?您应该使用LATC SFR而不是PORTC SFR定义I/O端口输出:应该是:也许这会有所帮助。
以上来自于百度翻译 以下为原文 Possible RMW issues?, you should define your I/O port outputs using the LATC sfr instead of the PORTC sfr: #define RS RC2 #define EN RC3 #define D4 RC4 #define D5 RC5 #define D6 RC6 #define D7 RC7 should be: #define RS LATCbits.LATC2 #define EN LATCbits.LATC3 #define D4 LATCbits.LATC4 #define D5 LATCbits.LATC5 #define D6 LATCbits.LATC6 #define D7 LATCbits.LATC7 MAybe this will help. |
|
|
|
你还把POTC I/O放入数字模式,默认为模拟:ANSELC=0;
以上来自于百度翻译 以下为原文 Also you ned to put the PORTC I/O into digital mode, it defaults to analog: ANSELC = 0; |
|
|
|
只有小组成员才能发言,加入小组>>
5237 浏览 9 评论
2026 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3201 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
772浏览 1评论
662浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
590浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
672浏览 0评论
572浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-21 14:27 , Processed in 1.432470 second(s), Total 105, Slave 88 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号