完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
好,所以我下载和更新XC16到1.33,我的代码将无法编译。好,所以我下载的文件,没有解决这个问题。好,所以我下载支持文件,什么也没有解决这个问题。是我还是没有延迟宏或头24FJ64 B00 2?
以上来自于百度翻译 以下为原文 OK so I download and update xc16 to 1.33 and my code won't compile. OK so I download the documentation and nothing to solve the problem. OK so I download the support files and nothing to solve the problem. Is it me or is there no delay macro or header for the 24fj64b002? /* * File: main.c * Author: David * * Created on January 29, 2018, 11:48 AM */ #include "xc.h" #include "delay.h" #define TTCY 8000000 // Fosc frequency for _delay() library // CONFIG4 #pragma config DSWDTPS = DSWDTPS2 // DSWDT Postscale Select (1:32 (33 ms)) #pragma config DSWDTOSC = LPRC // Deep Sleep Watchdog Timer Oscillator Select (DSWDT uses Low Power RC Oscillator (LPRC)) #pragma config RTCOSC = LPRC // RTCC Reference Oscillator Select (RTCC uses Low Power RC Oscillator (LPRC)) #pragma config DSBOREN = ON // Deep Sleep BOR Enable bit (BOR enabled in Deep Sleep) #pragma config DSWDTEN = ON // Deep Sleep Watchdog Timer (DSWDT enabled) // CONFIG3 #pragma config WPFP = WPFP63 // Write Protection Flash Page Segment Boundary (Highest Page (same as page 42)) #pragma config SOSCSEL = IO // Secondary Oscillator Pin Mode Select (SOSC pins have digital I/O functions (RA4, RB4)) #pragma config WUTSEL = LEG // Voltage Regulator Wake-up Time Select (Default regulator start-up time used) #pragma config WPDIS = WPDIS // Segment Write Protection Disable (Segmented code protection disabled) #pragma config WPCFG = WPCFGDIS // Write Protect Configuration Page Select (Last page and Flash Configuration words are unprotected) #pragma config WPEND = WPENDMEM // Segment Write Protection End Page Select (Write Protect from WPFP to the last page of memory) // CONFIG2 #pragma config POSCMOD = NONE // Primary Oscillator Select (Primary Oscillator disabled) #pragma config I2C1SEL = PRI // I2C1 Pin Select bit (Use default SCL1/SDA1 pins for I2C1 ) #pragma config IOL1WAY = ON // IOLOCK One-Way Set Enable (Once set, the IOLOCK bit cannot be cleared) #pragma config OSCIOFNC = OFF // OSCO Pin Configuration (OSCO pin functions as clock output (CLKO)) #pragma config FCKSM = CSECME // Clock Switching and Fail-Safe Clock Monitor (Sw Enabled, Mon Enabled) #pragma config FNOSC = FRC // Initial Oscillator Select (Fast RC Oscillator (FRC)) #pragma config PLL96MHZ = OFF // 96MHz PLL Startup Select (96 MHz PLL Startup is enabled by user in software( controlled with the PLLEN bit)) #pragma config PLLDIV = DIV2 // USB 96 MHz PLL Prescaler Select (Oscillator input divided by 2 (8 MHz input)) #pragma config IESO = ON // Internal External Switchover (IESO mode (Two-Speed Start-up) enabled) // CONFIG1 #pragma config WDTPS = PS1 // Watchdog Timer Postscaler (1:1) #pragma config FWPSA = PR32 // WDT Prescaler (Prescaler ratio of 1:32) #pragma config WINDIS = OFF // Windowed WDT (Standard Watchdog Timer enabled,(Windowed-mode is disabled)) #pragma config FWDTEN = ON // Watchdog Timer (Watchdog Timer is enabled) #pragma config ICS = PGx1 // Emulator Pin Placement Select bits (Emulator functions are shared with PGEC1/PGED1) #pragma config GWRP = OFF // General Segment Write Protect (Writes to program memory are allowed) #pragma config GCP = OFF // General Segment Code Protect (Code protection is disabled) #pragma config JTAGEN = OFF // JTAG Port Enable (JTAG port is disabled) void _init( void ){ // start from a known state return; } int main(void) { _init(); // initialize the device while(1){ ClrWdt(); // clear watchdog timer __delay_ms(500); // delay 0.5s //LATBbits.LATB0^=1; // toggle PB0 } return 0; } |
|
相关推荐
13个回答
|
|
|
一旦我使用:/* Delay的第二个* /延迟(Delayl 1sxCNT);and延迟(100);用XC16。
以上来自于百度翻译 以下为原文 Once I used: /* Delay for a second */ Delay(Delay_1S_Cnt); and Delay(100); with XC16. |
|
|
|
|
|
|
|
|
|
|
|
在“16位语言工具库参考手册”中搜索“X-DelayyMs”,它附带XC16编译器并位于编译器安装文件夹中。也就是说,你必须包括一个头文件并定义一个时钟频率符号。
以上来自于百度翻译 以下为原文 Search __delay_ms in the "16-Bit Language Tools Libraries Reference Manual" that comes with your XC16 compiler and located in the compiler install folder. I.e. you'll have to include a header file and define a clock frequency symbol. |
|
|
|
|
|
如果我没有错的话,Ay-DelayyMs-()和Ay-DelayuUs()在LIbPIC30.h中,并且依赖于定义的FCY宏。
以上来自于百度翻译 以下为原文 If I'm not mistaken, __delay_ms() and __delay_us() are in libpic30.h and depend on a FCY macro being defined. Mine is set up as: #define SYS_FREQ 16000000L //Clock Frequency #define FCY (SYS_FREQ/2) //Cycle Frequency #include |
|
|
|
|
|
1。我认为你不应该包括延迟。H(XC.H应该包括它)3.TTCY?我想FCY
以上来自于百度翻译 以下为原文 1. I do not think you nee to include delay.h (XC.h should include it) 3. TTCY?? I think FCY |
|
|
|
|
|
嗯,好的,抱歉。使用延迟。
以上来自于百度翻译 以下为原文 Hm. ok, sorry. used delay.h /********************************************************************** * © 2007 Microchip Technology Inc. * * FileName: main.c * Dependencies: Header (.h) files if applicable, see below * Processor: dsPIC33Fxxxx * Compiler: MPLAB® C30 v3.00 or higher * * SOFTWARE LICENSE AGREEMENT: * Microchip Technology Incorporated ("Microchip") retains all ownership and * intellectual property rights in the code accompanying this message and in all * derivatives hereto. You may use this code, and any derivatives created by * any person or entity by or on your behalf, exclusively with Microchip,s * proprietary products. Your acceptance and/or use of this code constitutes * agreement to the terms and conditions of this notice. * * CODE ACCOMPANYING THIS MESSAGE IS SUPPLIED BY MICROCHIP "AS IS". NO * WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED * TO, IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE APPLY TO THIS CODE, ITS INTERACTION WITH MICROCHIP,S * PRODUCTS, COMBINATION WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION. * * YOU ACKNOWLEDGE AND AGREE THAT, IN NO EVENT, SHALL MICROCHIP BE LIABLE, WHETHER * IN CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE OR BREACH OF STATUTORY DUTY), * STRICT LIABILITY, INDEMNITY, CONTRIBUTION, OR OTHERWISE, FOR ANY INDIRECT, SPECIAL, * PUNITIVE, EXEMPLARY, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, FOR COST OR EXPENSE OF * ANY KIND WHATSOEVER RELATED TO THE CODE, HOWSOEVER CAUSED, EVEN IF MICROCHIP HAS BEEN * ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT * ALLOWABLE BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO * THIS CODE, SHALL NOT EXCEED THE PRICE YOU PAID DIRECTLY TO MICROCHIP SPECIFICALLY TO * HAVE THIS CODE DEVELOPED. * * You agree that you are solely responsible for testing the code and * determining its suitability. Microchip has no obligation to modify, test, * certify, or support the code. *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * ADDITIONAL NOTES: * This code is tested on Explorer-16 board with ECAN PICTail Card. * The device used is dsPIC33FJ256GP710 controller * The delay parameters are approximated *************************************************************************************************/ #define Fcy 40000000 void Delay( unsigned int delay_count ); void Delay_Us( unsigned int delayUs_count ); #define Delay200uS_count (Fcy * 0.0002) / 1080 #define Delay_1mS_Cnt (Fcy * 0.001) / 2950 #define Delay_2mS_Cnt (Fcy * 0.002) / 2950 #define Delay_5mS_Cnt (Fcy * 0.005) / 2950 #define Delay_15mS_Cnt (Fcy * 0.015) / 2950 #define Delay_1S_Cnt (Fcy * 1) / 2950 and delay.c /********************************************************************* * * Simple Delay Routines * ********************************************************************* * FileName: delay.c * Dependencies: delay.h * Processor: dsPIC33F * Complier: MPLAB C30 v2.01.00 or higher * * Company: Microchip Technology, Inc. * * Software License Agreement * * The software supplied herewith by Microchip Technology Incorporated * (the Company) for its dsPIC30F Microcontroller is intended * and supplied to you, the Companys customer, for use solely and * exclusively on Microchip's dsPIC30F Microcontroller products. * The software is owned by the Company and/or its supplier, and is * protected under applicable copyright laws. All rights are reserved. * Any use in violation of the foregoing restrictions may subject the * user to criminal sanctions under applicable laws, as well as to * civil liability for the breach of the terms and conditions of this * license. * * THIS SOFTWARE IS PROVIDED IN AN AS IS CONDITION. NO WARRANTIES, * WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED * TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, * IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. * * Author Date Comment *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Richard Fischer 7/14/05 Initial release for LCD support * Priyabrata Sinha 1/27/06 Ported to non-prototype devices * ********************************************************************/ #include "delay.h" unsigned int temp_count; #if defined(__dsPIC33F__) void Delay( unsigned int delay_count ) { temp_count = delay_count +1; asm volatile("outer: dec _temp_count"); asm volatile("cp0 _temp_count"); asm volatile("bra z, done"); asm volatile("do #3200, inner" ); asm volatile("nop"); asm volatile("inner: nop"); asm volatile("bra outer"); asm volatile("done:"); } void Delay_Us( unsigned int delayUs_count ) { temp_count = delayUs_count +1; asm volatile("outer1: dec _temp_count"); asm volatile("cp0 _temp_count"); asm volatile("bra z, done1"); asm volatile("do #1500, inner1" ); asm volatile("nop"); asm volatile("inner1: nop"); asm volatile("bra outer1"); asm volatile("done1:"); } #elif defined(__PIC24H__) void Delay( unsigned int delay_count ) { temp_count = delay_count +1; asm volatile("outer: dec _temp_count"); asm volatile("cp0 _temp_count"); asm volatile("bra z, done"); asm volatile("repeat #3200" ); asm volatile("nop"); asm volatile("repeat #3200" ); asm volatile("nop"); asm volatile("bra outer"); asm volatile("done:"); } void Delay_Us( unsigned int delayUs_count ) { temp_count = delayUs_count +1; asm volatile("outer1: dec _temp_count"); asm volatile("cp0 _temp_count"); asm volatile("bra z, done1"); asm volatile("repeat #1500" ); asm volatile("nop"); asm volatile("repeat #1500" ); asm volatile("nop"); asm volatile("bra outer1"); asm volatile("done1:"); } #endif |
|
|
|
|
|
如果你报告错误信息是什么,那就更容易了。哪些文档?我在我的硬盘上的C:程序文件(x86)Microchip xC16v1.33中查看了XC16文件夹,看到了一个“DOCS”文件夹。在那里,我看到了“MPLABAXXC16CYCOMPILRIOUSER指南”PDF“打开”,搜索“延迟”,第一个匹配在第60页:“我怎样才能实现COD的延迟?”“?”点击LNK让我知道:参考手册在同一个文件夹中。搜索“我的”,(我的博爱)
以上来自于百度翻译 以下为原文 It would be easier to help if you reported what the error message was. Which documentation? I looked in the XC16 folder at C:Program Files (x86)Microchipxc16v1.33 on my hard drive, and saw a "docs" folder. Looking in there, I see "MPLAB_XC16_C_Compiler_Users_Guide.pdf" Opening that, and searching for "delay", the very first match is on page 60: "• How Can I Implement a Delay in My Code?" and clicking that lnk takes me to: The reference manual is in the same folder. Searching that for "__delay_ms" gives me: (My bolding) |
|
|
|
|
|
|
|
|
|
|
|
好吧,V1.32有一个延迟。H,但1.33并没有让我有点,但最终,这是秩序的定义和包括占主导地位…告诉你我是个白痴。;)
以上来自于百度翻译 以下为原文 OK the v1.32 had a delay.h but 1.33 didn't that threw me a bit but ultimately, it was the order of the define and includes that prevailed... told you I'm an idiot. ;) Attached Image(s) |
|
|
|
|
|
这个延迟是旧的PLIB外围库的一部分,它不包含你正在使用的延迟函数,它的全部内容是:
以上来自于百度翻译 以下为原文 That delay.h is part of the old PLIB peripheral libraries. It does NOT contain the delay functions you are using. The entire contents of it were: /* Change the following definition to match the instruction frequency of the application in MIPS (MHz) */ #if defined(__dsPIC33E__) || defined(__PIC24E__) #ifndef Fcy #define Fcy 60000000 #endif #endif #if defined(__dsPIC30F__) || defined(__dsPIC33F__) || defined(__PIC24H__) #ifndef Fcy #define Fcy 40000000 #endif #endif #define Delay_60nS_Cnt (Fcy * 0.00000006) #define Delay_150nS_Cnt (Fcy * 0.00000015) #define Delay_360nS_Cnt (Fcy * 0.00000036) #define Delay_450nS_Cnt (Fcy * 0.00000045) #define Delay_600nS_Cnt (Fcy * 0.0000006) #define Delay200uS_count (Fcy * 0.0002) #define Delay_1mS_Cnt (Fcy * 0.001) #define Delay_2mS_Cnt (Fcy * 0.002) #define Delay_5mS_Cnt (Fcy * 0.005) #define Delay_15mS_Cnt (Fcy * 0.015) #define Delay_1S_Cnt (Fcy * 1) /* delays specific to each LCD type */ /* delay btw RS/RW signal to E signal */ #define DelayRSSetupTime_Cnt Delay_60nS_Cnt /* delay btw E rise and Data available */ #define DelayDBOutput_Cnt Delay_360nS_Cnt /* min E pulse width low */ #define DelayEPulseWidthLow_Cnt Delay_150nS_Cnt /* min E pulse width high */ #define DelayEPulseWidthHigh_Cnt Delay_450nS_Cnt /* E pulse cycle time */ #define DelayEPulseWidth_Cnt Delay_600nS_Cnt /* min Power On Reset time */ #define DelayPORXLCD_Cnt Delay_15mS_Cnt /* generic delay for LCD */ #define DelayXLCD_Cnt Delay_5mS_Cnt |
|
|
|
|
|
我不认为你是白痴的原因:白痴不知道他们是白痴。他们没有线索…白痴不知道如何请求帮助或者去哪里。你来到正确的地方,即使白痴,不知何故,在一个有帮助的人绊倒的地方,他们没有告诉我们足够的帮助他们。他们寻求帮助,但显然认为他们已经知道足够的东西来决定什么是重要的。你不知道可用性,以及如何使用它,但这并不能使你成为白痴。无知和愚蠢是有区别的。(见脚注)底线:谢谢张贴。很多人都在论坛上发表文章,没有勇气提问。(也许他们认为我们会认为他们是白痴?)通过问一个合理的问题,得到了一个有帮助的回答,你帮助了别人,也帮助了你自己。DaveFootnote,“男人天生无知,而不是愚蠢。他们被教育愚弄了。”--- Bertrand Russel
以上来自于百度翻译 以下为原文 Reasons that I don't think you are an idiot:
A lot of people follow posts on this forum without ever having the courage to ask questions. (Maybe they think we will think they are idiots?) By asking a reasonable question that got a helpful response, you have helped others as well as yourself. Regards, Dave Footnote: "Men are born ignorant, not stupid. They are made stupid by education." ---Bertrand Russel |
|
|
|
|
|
我遇到过这样的问题。我可以通过我同事的XC 16 1.32传递我的代码,但是我不能超过1.33,错误是来自编译器内部的。所以我需要XC 16 1.32,但是我在网上找不到任何1.32。谁能提供给我?
以上来自于百度翻译 以下为原文 I have met such a problem. I can pass my code by my colleague's XC 16 1.32 but I can not pass by 1.33 that the mistakes is from compiler inside. So I need XC 16 1.32 but I can't find any 1.32 on the Internet.Who can provide it to me ? |
|
|
|
|
|
http://www. McCavig.com /开发工具/下载文件没有碰到死线与无关的问题。
以上来自于百度翻译 以下为原文 http://www.microchip.com/development-tools/downloads-archive Don't bump dead threads with unrelated issues. |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
501 浏览 0 评论
5811 浏览 9 评论
2350 浏览 8 评论
2237 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3543 浏览 3 评论
1159浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1120浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
888浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
501浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-13 03:24 , Processed in 1.098384 second(s), Total 96, Slave 79 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2389