完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我用的是PIC32 MX单片机。我的系统时钟和外围时钟是10MHz。我使用的是LCD 16X2显示器。通过这种设置,一切都很好,即液晶显示器是合适的。我已经添加了USB MSD支持的时钟为48 MHz。在将USB任务添加到主控循环的同时,我的LCD的行为也不同。现在我的问题是,如果USB被添加,为什么LCD的行为会有所不同?USB时钟频率在这方面有什么作用?
以上来自于百度翻译 以下为原文 I am using pic32mx Microcontroller. My system clock and peripheral clock is 10MHz. I am using an LCD 16X2 display. With this setup everything is working fine i.e LCD display is proper. I have added USB MSD support with clock 48MHz. After adding USB tasks into the master while loop, my LCD is behaving differently. Now my question is why LCD behaves differently if USB is added? Does USB clock frequency have any role in this? |
|
相关推荐
13个回答
|
|
嗯,当然可以,但是这当然取决于你如何处理LCD的时序……显示你的代码。
以上来自于百度翻译 以下为原文 Mmmm it could, but of course it depends on how you're handling timing for the LCD... Show your code maybe |
|
|
|
用于显示LCD显示的代码…{MPMPOPEN(PMPON on pMPa Read),3,PMPA DATAYBASY8,MMP1,PMPWAWITIGEB,4PMPWAITIX MID15,PMPWAITION Endo4,0x001,//只启用PMA0启用PMPIN ITENOFF;/ /没有中断使用/ /等待30 MsCuffelDelayinMS(30);/ /启动HD44 780显示8-位初始化序列PMPSETATE地址(LCDCMD);//选择命令寄存器PMPMaskDead(0x38);/8位INT,2行,5x7CuffDelayinMS(10);//g;48 PMPMaskRead(0x0C);//on,无光标,无Blink CuffelDelayinMS(10);//gt;48美国PMPMaskRead(0x01);//ClaseDePaseCuffelDelayinMS(2)0);//gt;1.6 ms PMPMistRead(0x06);//增量游标,没有SHIFTUTHOLDLAYNIMS(20);//gt;1.6 MS},我的主要while循环{{UpDeTeaDeDePlaskUnb();
以上来自于百度翻译 以下为原文 Code to Init LCD display... { mPMPOpen( PMP_ON | PMP_READ_WRITE_EN | 3, PMP_DATA_BUS_8 | PMP_MODE_MASTER1 | PMP_WAIT_BEG_4 | PMP_WAIT_MID_15 | PMP_WAIT_END_4, 0x0001, // only PMA0 enabled PMP_INT_OFF ); // no interrupts used // wait for >30 ms CustomDelayInMS( 30 ); //initiate the HD44780 display 8-bit init sequence PMPSetAddress( LCDCMD ); // select command register PMPMasterWrite( 0x38 ); // 8-bit int, 2 lines, 5x7 CustomDelayInMS( 10 ); //>48 us PMPMasterWrite( 0x0c ); // ON, no cursor, no blink CustomDelayInMS( 10 ); //>48 us PMPMasterWrite( 0x01 ); // clear display CustomDelayInMS( 20 ); //>1.6 ms PMPMasterWrite( 0x06 ); // increment cursor, no shift CustomDelayInMS( 20 ); //>1.6 ms } My main while loop do { _update_display_unit( ); _do_task_x(); _do_u***tasks(); }while( TRUE ); If I comment _do_u***tasks(), LCD display is good..:) |
|
|
|
猜测?USB接口会改变你的时间吗?中断和主循环之间的变量共享?缓冲区溢出?R-M W与端口写问题?
以上来自于百度翻译 以下为原文 Guesses? The USB interupt is changing you timing? Variables shared between the interrupt and main loop? Buffer overflows? R-m-w write issue with the port? |
|
|
|
奇怪的是,任何慢到原始代码只应该帮助LCD工作,或者主振荡器已经加速了USB需要。
以上来自于百度翻译 以下为原文 It's strange, any slow-down to the original code should only help LCD working Or maybe main oscillator has been speeded up for USB needs. Or one of the other reasons, yep |
|
|
|
当故障排除时,我将屏幕更新速度尽可能慢,现在你可以看到事情出错的地方。
以上来自于百度翻译 以下为原文 When troubleshooting i place the screen update rate to slow as possible, now you can see where things go wrong. |
|
|
|
是的,减速应该有助于正确的计时。但可以打破,我得到了幸运的时机。我在一个同事看到这个,抱怨他的LCD代码在EVE期满时停止工作。行为不同,可以指任何你想要的东西。事实上,它比破碎或不起作用少。它打开可能的显示器正在使用错误的消息。现在它是昏暗的,等等,任何方式,只有足够的信息来进行野性猜测。
以上来自于百度翻译 以下为原文 Yes a slow down should help proper timing. But can break, I got lucky timing. I saw this in a coworker complaining his LCD code stopped working when the eval period expired. Behaves differently, can mean any thing you want it to. It is actualy less discriptive than broken or does not work. It opens the possibly the display is working with the wrong message. It is dim now, etc. Any way, there is only enough information to take wild guesses. |
|
|
|
以下是我的Apple PrimaMead设置:Apple Pracl配置OnL/O/USB PLL启用的Pyl PrimaMac配置文件FPLLMUL= Muly20//PLL乘法器/PLL输出分频器,γ-PracMa配置,FPBDIV=DIVI8//外围时钟除法器,PracMA配置,FWDTEN=OF//看门狗定时器。一个配置FNOSC= PrPLOL// SelectionIf,PrimaFoSncC= PrimPLL,然后USB工作,但是显示仍然受到干扰。如果FNOSC被注释掉,那么显示很好,但是USB永远不会被检测到。
以上来自于百度翻译 以下为原文 Here are my find outs... The following are my #pragma settings #pragma config UPLLEN = ON // USB PLL Enabled #pragma config FPLLMUL = MUL_20 // PLL Multiplier #pragma config UPLLIDIV = DIV_2 // USB PLL Input Divider #pragma config FPLLIDIV = DIV_2 // PLL Input Divider #pragma config FPLLODIV = DIV_1 // PLL Output Divider #pragma config FPBDIV = DIV_8 // Peripheral Clock divisor #pragma config FWDTEN = OFF // Watchdog Timer #pragma config WDTPS = PS1 // Watchdog Timer Postscale #pragma config POSCMOD = HS // Primary Oscillator //If this one is not selcted, then u*** is not getting detected #pragma config FNOSC = PRIPLL // Oscillator Selection If the pragma FNOSC = PRIPLL is included then USB is working, but display still getting disturbed. If FNOSC is commented out, then display is fine but USB is never detected |
|
|
|
我的系统时钟和外围时钟设置,y*定义GETStaseClClOK()800 GoLealAlcOffice(GETSealClClOK)((1 & lt;& OSCCONbits.PBDIV))/将被划分为任何帮助。
以上来自于百度翻译 以下为原文 My system clock and peripheral clock settings, #define GetSystemClock() 80000000UL #define GetPeripheralClock() ( GetSystemClock()/(1 << OSCCONbits.PBDIV ) ) // Will be divided down Any help is appreciated..! |
|
|
|
你在哪里得到CuffDelayIn()?如果禁用PLL使其工作,那么你认为系统时钟是什么?你把它硬编码为80MHz究竟是什么?
以上来自于百度翻译 以下为原文 Where are you getting customDelayinMs()? If disabling the PLL makes it work, then what do you think you system clocked ? You have it hard coded as 80mhz what is it really? |
|
|
|
自定义延迟是毫秒…为此,我正在运行一个计时器…硬编码系统时钟&原因是得到适当的一秒计时器中断…
以上来自于百度翻译 以下为原文 Custom delay is in milliseconds ... for this i am running a timer.... hardcoding the system clock -> reason is to get a proper one second timer interrupt ... |
|
|
|
系统计时器?哪一个?当启用PLL时,您会理解它会加速。CuffDelayIn()可能是问题的根源。
以上来自于百度翻译 以下为原文 THE System Timer ? Which? You understand it will speed up when you enable the PLL. CustomDelayInMS() is probably the source of the problem. |
|
|
|
我知道FNOSC正在加速这件事…但是怎么不明白呢??
以上来自于百度翻译 以下为原文 I understand that FNOSC is speeding up the thing... but could not understand how ?? |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
5306 浏览 9 评论
2070 浏览 8 评论
1973 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3243 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2279 浏览 5 评论
828浏览 1评论
720浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
664浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
716浏览 0评论
616浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-1-26 15:53 , Processed in 1.345776 second(s), Total 101, Slave 85 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号