第一次用PIC16F1503,用来替代老的PIC16F616,
要用到PWM,使用MPLAB IDE V8.92编译不了,
具体如下:
#include<pic.h>
..
PWM1CON = 0b11000000; //使能PWM模块1&PWM1输出引脚RC5&高电平有效
PWM1DCH = 0b00000000; //PWM占空比高8位
PWM1DCL = 0b00000000; //PWM占空比低2位
PR2=249; //PWM周期=(PR2+1)×4Tosc×(TMR2预分频值)
编译出错:
Build F:\Test-1\PIC16F1503\16f1503 for device 16F1503
Using driver C:\Program Files\HI-TECH Software\PICC\9.82\bin\picc.exe
Make: The target "F:\Test-1\PIC16F1503\1.p1" is out of date.
Executing: "C:\Program Files\HI-TECH Software\PICC\9.82\bin\picc.exe" --pass1 F:\Test-1\PIC16F1503\c\1.c -q --chip=16F1503 -P --runtime=default,+clear,+init,-keep,+osccal,-download,-resetbits,-stackcall,+clib --opt=default,+asm,-debug,-speed,+space,9 --warn=0 -D__DEBUG=1 --rom=default --ram=default --double=24 --float=24 --addrqual=ignore -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
Error [192] F:\Test-1\PIC16F1503\c\1.c; 98.1 undefined identifier "PWM1CON"
Error [192] F:\Test-1\PIC16F1503\c\1.c; 102.1 undefined identifier "PWM1DCH"
Error [192] F:\Test-1\PIC16F1503\c\1.c; 103.1 undefined identifier "PWM1DCL"
********** Build failed! **********
不知道怎么解决!请用过的高手指点。 |