完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,伙计们!我使用PIC18F97 J60、XC8 V1.36和MPLAB X3.60,我们已经推出了一个没有WDT启用的产品。看门狗超时的配置是4毫秒(对于我们的目的来说太快)。在新版本中,我需要启用看门狗并改变看门狗超时。我发现了ththHTTP://www. MICROCHOC.COM/MU696216.ASPX-6962477,但我面临2个问题:SytRoS1——我试图用“C”ASM和“μEnMASM”混合C和汇编,但我得到编译器ErrOS。我尝试了ASM、ASM(“”),仍然得到了ErrOS…2——我在编译器文件夹中查看了PIC18F97 J60.C和PIC18F97 J60.H,并且没有找到常数字来访问COXT2。如果我解决了第一个问题,我将陷入第二个问题。我知道这是一个简单的问题,但我不知道如何解决。给我一些建议?最好的问候
以上来自于百度翻译 以下为原文 Hi guys! I´m using PIC18F97J60, XC8 v1.36 and MPLAB X 3.60 We have a product already launched without WDT enabled. The configuration of Watchdog timeout is 4 ms (too fast for our purposes). In the new version I need to enable watchdog and change the Watchdog timeout. I found this thread http://www.microchip.com/forums/m696216.aspx#696477 But i´m facing 2 problems with Syntax 1 - I´m trying to mix C and Assembly using #asm and #endasm but I get compiler erros. I tried _asm, asm ("") and still get erros... 2 - I looked PIC18F97J60.inc and Pic18F97J60.h in the compiler folders and didn´t find the constant word to access CONFIG2 If I solve the first problem I will stuck in the second one. I know this is a simple question but I don´t know how to solve. Can you give me some advices? Best Regards |
|
相关推荐
12个回答
|
|
在程序运行时或程序编译时,是否尝试更改看门狗超时周期?在编译时,你使用一个{ Trac-MaqMig-ToFig-WDTPS=(比率),(比率)是除法器比率(1,2,4,8,……):例如,这将看门狗定时器预分频器设置成1:327 68分频比。
以上来自于百度翻译 以下为原文 Are you trying to change the watchdog timeout period during runtime of the program or during program compile time? At compile time you use a #pragma config WDTPS = (ratio), (ratio) is divider ratio (1,2,4,8,......) for example: #pragma config WDTPS = 32768 This sets the watchdog timer prescaler to a 1:32768 divide ratio. |
|
|
|
嗨,在XC编译器安装的/DOCS文件夹中,有一组.html文件解释和记录每个PIC设备的配置设置的有效关键字和值。在一个单独的.c源文件中,尽管所有其他程序都是程序集,但在配置文件设置中没有其他需要的东西,只要文件被编译,并提供给链接器,它就不必被包含或从任何地方调用。但是,对于不同文件中的同一配置字,如果在配置字节中没有锁定WDT,则可以在RunTimeReGARD,Mysil中启用。
以上来自于百度翻译 以下为原文 Hi, In the /docs folder of XC compiler installation, there is a set of .html files explaining and documenting valid keywords and values for configuration settings for each and every PIC device. Start with: pic18_chipinfo.html It is the C language #pragma syntax documented there. You may have any or all #pragma config statements in a separate .c source file, even if all the rest of the program is assembly. There is nothing else needed in the .c file with configuration settings, and it need not to be included or called from anywhere,as long as the file is compiled, and given to the linker. There cannot however, be settings for the same configuration word in different files. If WDT isn't locked ON in configuration byte, it may be enabled in runtime Regards, Mysil |
|
|
|
Hi和[Link=Melto:Jack @ KkStack ] Jack @ KkStal[/Link ]和MySil,TKS为您的快速RealyJack,我想在RunTimeMysIL中进行更改,我的疑虑是如何在运行时改变,因为编译器似乎不接受关键字μASM、ASM或ASM(“”)。我已经试过这3个选项,但得到编译器ErrOS。你还有其他建议吗?又来了
以上来自于百度翻译 以下为原文 Hi and [link=mailto:jack@kksound]jack@kksound[/link] and MySil, tks for your fast reply Jack, I want to change in runtime Mysil, my doubt is how to change in runtime, because it seems that compiler doesn´t accept the keywords #asm, _asm or asm(""). I´ve tried these 3 options, but get compiler erros. Do you have any other advice?? Tks again |
|
|
|
此外,MPLABX中的配置位设置窗口将为您编写所有的PyrPrima-COMPIG语句,它们通常是正确的。
以上来自于百度翻译 以下为原文 Also the configuration bits setting window in MPLABX will write all the #pragma config statements for you and they are usually correct. |
|
|
|
你可以把我在那个链接中的例程翻译成C。我可以在几分钟内完成,但是我现在很忙。
以上来自于百度翻译 以下为原文 You can translate my routine in that link into C. I can do it in few minutes, but I'm kinda busy right now. |
|
|
|
在这里:
以上来自于百度翻译 以下为原文 Here: void WriteWDT(uint8_t postscale) { uint8_t flag = 0; ClrWdt(); WDTCONbits.SWDTEN = 0; TBLPTR = 0x300003; TABLAT = postscale; asm("TBLWT"); EECON1 = 0b11000100; if (INTCONbits.GIE) { INTCONbits.GIE = 0; flag = 1; } EECON2 = 0x55; EECON2 = 0xAA; EECON1bits.WR = 1; if (flag) INTCONbits.GIE = 1; EECON1bits.WREN = 0; WDTCONbits.SWDTEN = 1; } |
|
|
|
哦,对不起,我没意识到人们已经回答了这个问题。论坛布局是混乱的。你连接的线程也是关于在运行时改变WTD的。如果要在启动时设置PistCalver值,我建议你使用宏,具有后缩放器的期望值。
以上来自于百度翻译 以下为原文 Oops, sorry I didn't realised people had already answered the question. The forum layout is confusing. The thread you've linked too is about changing the WTD during runtime. |
|
|
|
用这个代替这个应该更有效。;)
以上来自于百度翻译 以下为原文 Replace this if (INTCONbits.GIE) { INTCONbits.GIE = 0; flag = 1; } with this if (INTCONbits.GIE) { flag++; INTCONbits.GIE = 0; } should be more efficient. ;) |
|
|
|
嗨,伙计们,TKS再次为你们提供帮助。TKS 1和0我在这里运行代码,但是在执行例行程序之后,我的板就死了。我需要再和PicKit一起编程。你认为我不能改变这张照片中的配置词吗?我想我可以,因为我看到了数据表页363,但现在,读得更仔细,我已经注意到WO(写一次),我在下面展示。所以,我不能在运行时改变,对吗?链接到IMAGE HTPSP//www. DROPBOX.COM/S/AZTBI1E6K2C7QSD/CAPTURAR.PNG?DL=0Br
以上来自于百度翻译 以下为原文 Hi guys, tks again for your help. Tks 1and0 I ran the code here, but after execute the routine my board dies. I need to program with PicKit again. Do you think I can´t change Config words in this Pic? I thought I could because I saw in datasheet page 363 But now, read more carefuly I´ve noticed WO (write once) as I show below. So, I can´t change in runtime, correct? Link to the image https://www.dropbox.com/s/aztbi1e6k2c7qsd/Capturar.PNG?dl=0 BR |
|
|
|
哦,你使用的是PIC18FJ系列,其中配置数据存储在片上程序存储器空间顶部的四个字中。我想一个正常的闪存写入这个空间会起作用。当然,您需要一个电源周期来进行更改。&编辑:将地址更改为0x1FFFB,然后再试一次,即,编辑& gt;您可能需要以XX字节块写入,而不是只写一个字节,用于正常的Flash写入。也就是说,读取该块,修改所需的字节,擦除块,然后写入块(s)。通常,擦除块大小不同于写入块大小。
以上来自于百度翻译 以下为原文 Oh, you're using a PIC18FJ series, where the config data is stored in the four words at the top of the on-chip program memory space. I'm wondering a normal flash write to this space would work. Of course, you would need a power cycle for the change to take effect. TBLPTR = 0x01FFFB; |
|
|
|
嗯,对了。TKS 1和0我会尝试这个结果后最好的问候
以上来自于百度翻译 以下为原文 Hmm oh right. Tks 1and0 I will try this and post de results Best regards |
|
|
|
嗨,伙计们,让你们知道。我不能在这个职位上写东西。也许我做错了什么,但现在我没有太多时间在这个问题上。因此,我解决了读取像StistBLPTR=0x1FFFBASASTBLRD,EntasMuxByTe1= TabLAT相关的位置,然后测试AbxByT1并查看它是否运行了我的程序的旧版本(它是用标量值的后置标尺)或一个新版本。然后我决定是否启用看门狗。TKS再次为您提供帮助。
以上来自于百度翻译 以下为原文 Hi guys, just to let you know. I couldn´t write in this position. Maybe I am doing something wrong, but I don´t have much time to spend on this issue now. So I solved just reading the position related to CONFIG2H like this TBLPTR = 0x1FFFB _asm TBLRD _endasm auxByte1 = TABLAT; Then I test auxByte1 and see if it´s running a old version of my program (which were made with nominal value of postscaler) or a new version. Then I decide if enable or not the watchdog. Tks again for you help |
|
|
|
只有小组成员才能发言,加入小组>>
5253 浏览 9 评论
2038 浏览 8 评论
1958 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3219 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2267 浏览 5 评论
792浏览 1评论
688浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
617浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
686浏览 0评论
586浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-30 13:34 , Processed in 1.804300 second(s), Total 99, Slave 82 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号