这是我的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.
请问该怎么修改呢?
非常感谢各位
|