完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗯,我从来没有这么沮丧过。我的计划失败了。我准备放弃使用MCC,在一年左右再试一次。使用16F1827与MPLAB C IDE v3.35我用MCC 3.15Mtouch对四个按钮进行mtouch操作,在8mHz以上与INTOSC不工作。使用PWM3和PWM4但不使用mTouch按钮,不能使用EPWM1和EPWM2与si一起工作。MPLESMCC。代码编译和加载。什么也没有发生。没有定时器的组合。当输出被配置为GPIO,但不使用EPWM时,我可以设置位。如果我使用定时器,然后决定从项目资源中删除它,那么在我尝试构建时,代码仍然会抛出错误。计时器出现在设备资源中。如果我把定时器放回Project资源中而不使用它,代码就会再次编译。当我不那么沮丧时,我会整理一篇完整的帖子。我可能不得不手动重新做这件事,它花费的时间更少,而且工作起来了,并且我理解它是如何工作的。对于MCC,如果代码不工作,我会不知所措。克雷格的作品
以上来自于百度翻译 以下为原文 Well, I've never been so frustrated. My project is stalled. I'm ready to give up on MCC and try it again in a year or so. Using 16F1827 with MPLAB C IDE v3.35 I got mtouch working on four buttons with MCC 3.15 Mtouch did not work with INTOSC over 8mHz. Got PWM3 and PWM4 working but not with the mTouch buttons CANNOT get EPWM1 and EPWM2 to work at all with the simplest mcc set up. Code compiles and loads. Nothing happens. No combination of timers works. I can set the bits when the outputs are configured as GPIO but not with EPWM. If i use a timer then decide to delete it from the project resources, code remains that throws an error when I try to build. Timer appears in the Device Resources. If i put the timer back into Project resources and NOT use it, code compiles again. I will put together a complete post when I'm not so frustrated. I may have to go back to doing this manually, It took less time and it worked, and I understood how it worked. With MCC I am at a loss if the code does not work. Craig |
|
相关推荐
6个回答
|
|
好的,我想我会再试一次。我用MPLabX IDE 3.35MCC v3.15.0ICD 3,16F1827在我自己的板上。现在每个pwm输出引脚上有4个LED。对GRUNDI的折衷可以使用简单的端口写来打开和关闭。CCP3和CCP4工作良好。ECP1和ECP2没有。(我想要单个输出)创建了一个新项目。在参考资料中的INTOSC 8MHz时钟No PLLTMR4和ECCP1将这个代码插入到main.cTried,在while循环之前插入以下代码,以查看是否有东西没有被正确初始化。再一次通过简单的端口b设置,我可以闪烁LED。这是MCC生成的EPWM.c初始化:有人看到我做错了什么吗?感谢任何帮助!谢谢,克雷格
以上来自于百度翻译 以下为原文 Ok I thought I would try this one more time. I'm using MPLabX IDE 3.35 MCC v3.15.0 ICD 3, 16F1827 in my own board Currently has 4 LEDs on each pwm output pin. Refrenced to ground I can use simple port writes to turn them on and off. CCP3 and CCP4 work fine. ECCP1 and ECCP2 do not. (I want single outputs) Created a new project. INTOSC 8MHz Clock No PLL TMR4 and ECCP1 in Resources in MCC Added this code to main.c while (1) { for (int duty = 1; duty < 255; duty = duty + 10) { EPWM1_LoadDutyValue(duty); for (int delay = 1; delay < 500; delay++) {;} } // Add your application code } Tried inserting the following before the while loop to see if something was not initialized correctly. Toggled TRIS to make sure. PIN_MANAGER_Initialize(); TMR4_Initialize(); TMR4_StartTimer(); EPWM1_Initialize (); TRISB = 0xFF; TRISB = 0xF7; Code compiles fine Writes to pic fine. No PWM from P1A which is PortB pin 3. Again with simple setting of port b I can flash the LED. This is the MCC generated EPWM.c initialization : void EPWM1_Initialize (void) { // Set the PWM to the options selected in MPLAB(c) Code Configurator // CCP1M P1A,P1C: active high; P1B,P1D: active high; DC1B 1; P1M single; CCP1CON = 0x1C; // CCP1ASE operating; PSS1BD low; PSS1AC low; CCP1AS disabled; ECCP1AS = 0x00; // P1RSEN automatic_restart; P1DC 0; PWM1CON = 0x80; // STR1D P1D_to_port; STR1C P1C_to_port; STR1B P1B_to_port; STR1A P1A_to_port; STR1SYNC start_at_begin; PSTR1CON = 0x00; // CCPR1L 62; CCPR1L = 0x3E; // CCPR1H 0; CCPR1H = 0x00; // Selecting Timer4 CCPTMRS0bits.C1TSEL = 0x1; } Anyone see what I'm doing wrong? Grateful for any help! Thanks, Craig |
|
|
|
对不起,我在这里张贴,这是EPWM问题,而不是MtAccess。
以上来自于百度翻译 以下为原文 Sorry I posted that here, this is EPWM issue not mTouch. |
|
|
|
我把这个线程分割成自己的,以帮助它获得更多的可见性。你可能想改变标题——它不会让我为你做这件事。我也会指出一些人来看看他们是否有任何建议。
以上来自于百度翻译 以下为原文 I split this thread into its own to help get it some more visibility. You may want to change the title - it won't let me do that for you. I'll also point some people to this to see if they have any suggestions. |
|
|
|
我用一个CCP3和ECP1创建了一个项目,两个都使用定时器2。PWM工作EPWM没有。我会尝试新版本的MCC看看会发生什么。这是EPWM初始化代码:
以上来自于百度翻译 以下为原文 I created a project with one CCP3 and ECCP1, both using timer 2. PWM works EPWM does not. I'll try the new version of MCC to see what happens. This is the EPWM initializing code: void EPWM1_Initialize (void) { // Set the PWM to the options selected in MPLAB(c) Code Configurator // CCP1M P1A,P1C: active high; P1B,P1D: active high; DC1B 3; P1M single; CCP1CON = 0x3C; // CCP1ASE operating; PSS1BD low; PSS1AC low; CCP1AS disabled; ECCP1AS = 0x00; // P1RSEN automatic_restart; P1DC 0; PWM1CON = 0x80; // STR1D P1D_to_port; STR1C P1C_to_port; STR1B P1B_to_port; STR1A P1A_to_port; STR1SYNC start_at_begin; PSTR1CON = 0x00; // CCPR1L 124; CCPR1L = 0x7C; // CCPR1H 0; CCPR1H = 0x00; // Selecting Timer2 CCPTMRS0bits.C1TSEL = 0x0; } void EPWM1_LoadDutyValue(uint16_t dutyValue) { // Writing to 8 MSBs of pwm duty cycle in CCPRL register CCPR1L = ((dutyValue & 0x03FC)>>2); // Writing to 2 LSBs of pwm duty cycle in CCPCON register CCP1CON = (CCP1CON & 0xCF) | ((dutyValue & 0x0003)<<4); } |
|
|
|
找到它了!PSTR1CON需要设置为0x01(STR1A)才能使P1A工作。即使我没有使用转向,这个位也需要设置,否则它是一个端口引脚。我看不出用MCC中的转向接口来设置这个的方法。如果我启用转向和检查PxA,我仍然不能在P1A上得到输出。我现在有4个PWM o。乌托邦!克雷格
以上来自于百度翻译 以下为原文 Found it! PSTR1CON needs to be set to 0x01 (STR1A) to get P1A to work. Even though i'm not using steering this bit needs to be set otherwise it is a port pin. I don't see a way to set this using the steering interface in MCC. If I enable steering and check PxA I still do not get output on P1A. I now have 4 PWM outputs! Craig |
|
|
|
令人惊叹的!我试过了,效果很好!我可以完成我的计划。我的妻子谢谢你。谢谢。
以上来自于百度翻译 以下为原文 Awesome! I just tried it. Works like a charm! I can finish my project. My wife thanks you all. Thanks. Craig |
|
|
|
只有小组成员才能发言,加入小组>>
5243 浏览 9 评论
2035 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3208 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2258 浏览 5 评论
778浏览 1评论
669浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
597浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
679浏览 0评论
577浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 07:14 , Processed in 1.341503 second(s), Total 86, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号