PICC 9.82 头文件问题

2020-02-08 09:03发布

本人最近用PIC16F887做个小项目,但是在用PICC 9.82  进行编译时出问题。
如果 这样调用头文件,#include<htc.h>
编译如下提示
Build I:TOUCH KEYPIC16F887TESTPIC16F887TEST for device 16F877
Using driver D:Program FilesHI-TECH SoftwarePICC9.82inpicc.exe

Make: The target "I:TOUCH KEYPIC16F887TESTPIC16F887TEST.p1" is out of date.
Executing: "D:Program FilesHI-TECH SoftwarePICC9.82inpicc.exe" --pass1 "I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C" -q --chip=16F877 -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] I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C; 56.1 undefined identifier "OSCCON"
Error   [192] I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C; 73.1 undefined identifier "CM1CON0"
Error   [192] I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C; 74.1 undefined identifier "CM2CON0"
Error   [192] I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C; 75.1 undefined identifier "VRCON"
Error   [192] I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C; 76.1 undefined identifier "SRCON"
Error   [192] I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C; 77.1 undefined identifier "CM2CON1"
Error   [192] I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C; 82.1 undefined identifier "BAUDCTL"
Error   [192] I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C; 84.1 undefined identifier "SPBRGH"
Error   [192] I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C; 89.1 undefined identifier "ANSEL"
Error   [192] I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C; 90.1 undefined identifier "ANSELH"
Error   [192] I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C; 272.1 undefined identifier "CM1CON0"
Error   [192] I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C; 273.1 undefined identifier "CM2CON0"
但如果这样调用//#include<pic16F887.h>
则编译能通过,只是提示用上边头文件代替,编译结果如下:
Build I:TOUCH KEYPIC16F887TESTPIC16F887TEST for device 16F877
Using driver D:Program FilesHI-TECH SoftwarePICC9.82inpicc.exe

Make: The target "I:TOUCH KEYPIC16F887TESTPIC16F887TEST.p1" is out of date.
Executing: "D:Program FilesHI-TECH SoftwarePICC9.82inpicc.exe" --pass1 "I:TOUCH KEYPIC16F887TESTsourcePIC16F887TEST.C" -q --chip=16F877 -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"
Warning [162] D:Program FilesHI-TECH SoftwarePICC9.82includepic16F887.h; 3.81 #warning: Header file pic16f887.h included directly. Use #include <htc.h> instead.
Executing: "D:Program FilesHI-TECH SoftwarePICC9.82inpicc.exe" -oPIC16F887TEST.cof -mPIC16F887TEST.map --summary=default,-psect,-class,+mem,-hex --output=default,-inhx032 PIC16F887TEST.p1 --chip=16F877 -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"
HI-TECH C Compiler for PIC10/12/16 MCUs (PRO Mode)  V9.82
Copyright (C) 2011 Microchip Technology Inc.
Serial number: HCPICP-11111 (PRO)

Memory Summary:
    Program space        used   4F5h (  1269) of  2000h words   ( 15.5%)
    Data space           used    5Ch (    92) of   170h bytes   ( 25.0%)
    EEPROM space         used     0h (     0) of   100h bytes   (  0.0%)
    Configuration bits   used     0h (     0) of     1h word    (  0.0%)
    ID Location space    used     0h (     0) of     4h bytes   (  0.0%)

Loaded I:TOUCH KEYPIC16F887TESTPIC16F887TEST.cof.

********** Build successful! **********

我查看了下INLUDE 里面的各个头文件,应该用#include <htc.h>方式就可以,但切不知道错误在哪里,没能找到,
不知是否也有人遇到我样的问题,指导下,先谢了!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。