智能车制作

 找回密码
 注册

扫一扫,访问微社区

查看: 1172|回复: 1
打印 上一主题 下一主题

[调试类] 求助啊

[复制链接]

5

主题

21

帖子

0

精华

高级会员

Rank: 4

积分
541
威望
285
贡献
144
兑换币
169
注册时间
2015-5-10
在线时间
56 小时
毕业学校
湖北汽车工业学院
跳转到指定楼层
1#
发表于 2015-8-3 17:23:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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 */
}

代码如上

大神求助啊


回复

使用道具 举报

10

主题

1514

帖子

0

精华

金牌会员

智能车,首选泰庆

Rank: 6Rank: 6

积分
1715

活跃会员奖章在线王奖章

QQ
威望
427
贡献
400
兑换币
497
注册时间
2014-11-4
在线时间
444 小时
2#
发表于 2015-8-4 12:40:34 | 只看该作者
之前没遇到过- -顶一个。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

关于我们|联系我们|小黑屋|智能车制作 ( 黑ICP备2022002344号

GMT+8, 2024-9-26 00:32 , Processed in 0.060687 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表