打印

请高手过来帮忙

[复制链接]
2371|4
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
renmay|  楼主 | 2008-12-25 15:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
这是我的5402定时器产生方波的程序,目的是用CCS查看数据区1000H的波形,但是出现的错误,望各位高手给予解答~


#include <stdio.h>
#include "fangbo.h"

#define uchar unsigned char 
#define uint unsigned int

#define TIM *(volatile uint *)0x0024  //time0 register TIM,24H
#define PRD *(volatile uint *)0x0025  //time0 period counter PRD,25H
#define TCR *(volatile uint *)0x0026  //time0 control register TCR,26H

#define IFR *(volatile uint *)0x0001  //interrupt flag register,01H
#define IMR *(volatile uint *)0x0000  //interrupt mast register,00H
#define PMST *(volatile uint *)0x001D //prosessor mode status,1DH

#define period 0Xf000
        int j=0;        //定义外部变量

int out_buffer[BUFSIZE];

// &out_buffer[0] = 0x1000;

interrupt void time0_isr(void)   //time0中断服务程序

asm(" PSHM ST1");
asm(" PSHM ST0");

j++;
if (j>20) j=0;

asm(" POPM ST0");//出栈
asm(" POPM ST1");
}
//////////////////////
void timer0_init(void)  //time0 初始化程序
{
  asm(" SSBX INTM");
  PMST&=0x007f;
  PMST|=0x0080;
  TCR=0x0010;//停止计数
  TIM=period;
  PRD=period;//    装载TIM
  TCR=0x0D00;//开始计数
// asm(" STM #0008h,IFR");
  IMR=0X0008;//开定时器中断
  IFR=0Xffff;//清除已经起的中断
  
  asm(" RSBX INTM");//开全局中断
  //asm(" SSBX XF");
  
}


void main(void)   //主程序
{
   int  *output = &out_buffer[0];
  
    timer0_init();
   
   for(output=0;output<BUFSIZE;output++)
   {
       out_buffer[output]=0;
   }
   
   output=0;
   
   while(1)
     {   
           asm(" NOP");
           if (j<10) 
                {//asm(" SSBX XF");
                 out_buffer[output++]=0xFFFF;
                 }
            else 
                 {
                 //asm(" RSBX XF");
                 out_buffer[output++]=0x0000;
                 }
     }
   
}



错误如下:
----------------------------  dingshi.pjt - Debug  ----------------------------
"d:c5500c5400cgtoolsincl500" -g -q -fr"D:/c5500/myprojects/fangbo_C/Debug" -d"_DEBUG" -@"Debug.lkf" "dingshi.c"
[dingshi.c]
"dingshi.c", line 59: error: operand types are incompatible ("int *" and "int")
"dingshi.c", line 61: error: expression must have integral type
"dingshi.c", line 71: error: expression must have integral type
"dingshi.c", line 76: error: expression must have integral type
4 errors detected in the compilation of "dingshi.c".

"d:c5500c5400cgtoolsincl500" -g -q -fr"D:/c5500/myprojects/fangbo_C/Debug" -d"_DEBUG" -@"Debug.lkf" "vector.asm"
<vector.asm>

Build Complete,
  4 Errors, 0 Warnings, 0 Remarks.


请问该怎么修改呢?

非常感谢各位 

相关帖子

沙发
TI_CPIC| | 2008-12-26 16:53 | 只看该作者

Re:TMS320VC5402

查一下

使用特权

评论回复
板凳
TI_CPIC| | 2008-12-29 15:48 | 只看该作者

Re:TMS320VC5402

int  *output = &out_buffer[0]; 改成 int  output;

请教楼主,此处为什么要使用指针?

使用特权

评论回复
地板
福瑞斯| | 2008-12-30 22:23 | 只看该作者

。。。。。。。。。

晕这么长的程序,TI_CPIC你还真看啊。。。。敬业啊,敬业啊。
为TI_CPIC鼓掌,不容易啊。

使用特权

评论回复
5
我是学生| | 2008-12-31 14:57 | 只看该作者

我也看了

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

9

主题

19

帖子

0

粉丝