高级会员
- 积分
- 541
- 威望
- 285
- 贡献
- 144
- 兑换币
- 169
- 注册时间
- 2015-5-10
- 在线时间
- 56 小时
- 毕业学校
- 湖北汽车工业学院
|
xs128用codewarrior编译之后出现的结果是这样
[url=]L1907: Fixup overflow in <Object>, type <objType> at offset <Address>[/url][DISABLE, INFORMATION, WARNING, ERROR] [url=]Description[/url]An illegal relocation of an object is detected in the object file <Object> at address <Address>. The type of the object is given in <objType>. [url=]Tips[/url]- Check the relocation at that address. The offset may be out of range for this relocation type. If not it may be caused by a corrupt object file.
- Check if all objects are allocated in the correct area. Is the object correctly declared?
- This error might occur if the zero paged variables are allocated out of the zero page.
#include <hidef.h> /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
/*-----------端口定义----------*/
#define LED PORTB
#define LED_dir DDRB
/*-----------变量定义----------*/
#define uchar unsigned char
#define uint unsigned int
uint Time_count=0;
uchar LED_flag=0;
uchar aa;
/*-----------延时函数----------*/
void delay(uint a)
{
uint i,j;
for(i=0;i<a;i++)
for(j=0;j<a;j++)
;
}
/*-----------端口初始化----------*/
void Port_initial()
{
LED_dir=0xff;
}
/*-----------PIT模块初始化----------*/
void PIT_initial()
{
PITTF_PTF=0x0f; //清除中断标志位
PITCFLMT_PITE=1; //打开PIT模块
PITMTLD0=0x00c7; //设定8位微定时器初值
PITLD0=0x0c7f; //设16位定时器0初值
PITMUX_PMUX0=0; //定时器0与微定时器0串级
PITCE_PCE0=1; //打开定时器0的通道
PITINTE_PINTE0=1; //允许定时器0的通道中断
}
//定时周期=(199+1)*(3199+1)/16MHz=0.04s
/*-----------指示灯函数----------*/
void light1()
{
uchar i=1;
aa=0xfe;
while(i)
{
LED=aa;
delay(500);
aa<<=1;
delay(500);
}
}
void light2()
{
uchar i=1;
aa=0xfe;
while(i)
{
LED=aa;
delay(500);
aa>>=1;
delay(500);
}
}
/*-----------PIT通道0中断服务程序----------*/
#pragma CODE_SEG_NEAR_SEG NON_BANKED
void interrupt 66 PIT_0()
{
Time_count++; //定时周期增加一个
if(Time_count==50)
{
LED_flag=1;
Time_count=0;
}
PITTF_PTF0=1;
}
/*-----------主函数----------*/
void main(void)
{
/* put your own code here */
uchar i=5;
Port_initial(); //端口初始化
PIT_initial(); //PIT初始化
EnableInterrupts; //允许中断
while(i--)
{
light1(); //正常状态
if(LED_flag==1) //定时到了之后,变换闪烁顺序
{
LED_flag=0;
light2();
}
}
for(;;)
{
//_FEED_COP(); /* feeds the dog */
} /* loop forever */
/* please make sure that you never leave main */
}
代码如上
大神求助啊
|
|