论坛» 高校专区» 坤创E-Geek/天科大新电社

stc12c5a60s2头文件问题??、、

菜鸟
2014-04-27 08:57 1楼
我之前做了一东西开始用的是89c52后来换成stc12c5a60s2,用到12864,ds1302,at24c02,这三个东西我都是写成头文件的形式添加到工程里面去的,另外stc12c5a60s2的头文件用的是宏晶官网上的那个。
(stc12c5a60s2单片机 ) (89c52单片机)
#include ----------------------------- #include
#include"AT24C02.h" -------------------------#include"AT24C02.h"
#include"LCD12864.h"---------------------- -#include"LCD12864.h"
#include"UART.h" ----------------------------- #include"UART.h"
#include"DS1302.h" -------------------------- #include"DS1302.h"


问题就是,之前用的是89c52也是用同样的同文件方式运行工程没错误,现在用stc12c5a60s2也是以头文件的方式他就出错了呀。后来火了所用的同文件都不用了全部写在主函数上面,结果没有报错,纳闷呀

错误信息如下:应该是51头文件里的东西重复定义了??
STC.h(4): error C231: 'ACC': redefinition
STC.h(5): error C231: 'B': redefinition
STC.h(6): error C231: 'PSW': redefinition
STC.h(8): error C231: 'CY': redefinition
STC.h(9): error C231: 'AC': redefinition
STC.h(10): error C231: 'F0': redefinition
STC.h(11): error C231: 'RS1': redefinition
STC.h(12): error C231: 'RS0': redefinition
STC.h(13): error C231: 'OV': redefinition
。。。。。。。。后面还有。。。。。。。。。
菜鸟
2014-04-27 09:01 2楼


stc头文件

sbit PADC = IP^5; //ADC ?????

sbit PS = IP^4;
sbit PT1 = IP^3;
sbit PX1 = IP^2;
sbit PT0 = IP^1;
sbit PX0 = IP^0;
//-----------------------
// 7 6 5 4 3 2 1 0 Reset Value
sfr IPH = 0xB7; //??????? PPCAH PLVDH PADCH PSH PT1H PX1H PT0H PX0H 0000,0000
sfr IP2 = 0xB5; // - - - - - - PSPI PS2 xxxx,xx00
sfr IPH2 = 0xB6; // - - - - - - PSPIH PS2H xxxx,xx00
//-----------------------
//??? 1T 8051?? ???I/O ????????
// 7 6 5 4 3 2 1 0 Reset Value
sfr P0 = 0x80; //8 bitPort0 P0.7 P0.6 P0.5 P0.4 P0.3 P0.2 P0.1 P0.0 1111,1111
sfr P0M0 = 0x94; // 0000,0000
sfr P0M1 = 0x93; // 0000,0000
sfr P1 = 0x90; //8 bitPort1 P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0 1111,1111
sfr P1M0 = 0x92; // 0000,0000

sfr P1M1 = 0x91; //

、、、、、、、、、、、

、、、、、、、、、、、、

菜鸟
2014-04-27 11:57 3楼
哦解决了, stc12c5a60s2.h这个头文件在keil-inc里面的位置问题
院士
2014-04-27 20:56 4楼
自问自答,自己找到解决问题的办法是非常高兴的一件事
菜鸟
2014-04-28 06:51 5楼
呵呵,就是想和大伙分享一下,避免类似错误
高工
2014-04-28 07:25 6楼
头文件的放置位置一定好,,这个以后还会用到呢
菜鸟
2019-04-19 17:21 7楼

我也出现这个问题了,请问您是怎么解决的呢?

我的qq号1185057916,望指教

共7条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册]