打印

请教xc167汇编编译时的问题

[复制链接]
1339|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
turkboy|  楼主 | 2007-11-8 21:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我是初学者,可能下面请教的问题可能和初始化有关,请大家指点
我想用capcom2产生一种变化脉宽信号,并通过AD控制频率,汇编变好后在编译的时候出现如下问题:
Build target 'Target 1'
compiling MAIN.C...
MAIN.C(2): error C25: syntax error near ':'
MAIN.C(4): warning C34: 'ADC_INIT': missing declaration specifiers
MAIN.C(4): error C42: 'ADC_INIT': not in formal parameter list
MAIN.C(4): error C25: syntax error near 'CALLA'
MAIN.C(4): warning C34: 'CALLA': missing declaration specifiers
MAIN.C(4): error C42: 'CALLA': not in formal parameter list
MAIN.C(5): warning C34: 'CC2_INIT': missing declaration specifiers
MAIN.C(5): error C42: 'CC2_INIT': not in formal parameter list
MAIN.C(5): warning C34: 'BSET': missing declaration specifiers
MAIN.C(5): error C42: 'BSET': not in formal parameter list
MAIN.C(6): warning C34: 'IEN': missing declaration specifiers
MAIN.C(6): error C42: 'IEN': not in formal parameter list
MAIN.C(6): warning C34: 'MOV': missing declaration specifiers
MAIN.C(6): error C42: 'MOV': not in formal parameter list
MAIN.C(6): warning C34: 'R3': missing declaration specifiers
MAIN.C(6): error C42: 'R3': not in formal parameter list
MAIN.C(53): error C7: compilation aborted
Target not created

源程序如下:
MAIN:
  CALLA ADC_INIT//
  CALLA CC2_INIT//
  BSET IEN// 
  MOV R3,#2//  
AA:
  JBC ADCIR,ADC_INTE//程序并清零标志位
  AJMP AA//
ADC_INIT:
  MOVE P5DIDIS,#0002H//
  MOV ADC_CIC,#4FH//;开AD中断,并取ILVL=3,GLVL=3
  MOV ADC_CON,#91H//;0-3位,通道选择,4-5位模式选择,7位启动AD
  RET

CC2_INIT:
  MOVE T78CON,#0000H//计数频率
  EXTR #04//
  MOV T7,#OOOOH//; 设定时器初值
  MOV T7REL,#0000H//;设定时器重装载寄存器初值
  SETB DP9.P0//; 把p9.0端口设置为输出
  BCLR ALTSEL0P9.P0//;
  SETB ALTSEL1P9.P0//;选择端口复用功能
  MOV CC2_M4,#0007H//;把cc16分配给T7,并用比较方式3
  MOV CC16,#8000H//;设置比较寄存器初值
  OR T78CON,#0040H//;开启定时器T7
  RET//

ADC_INTE:
  MOV R4,ADC_DAT//; 读转换结果
  AND R4,#3FFH       //;取转换结果
  SHL R4,#6//;将10位的转换结果左移6位
  MOV T7REL,R4//;将修改值存入T7重装载寄存器
  CMP R3,#4//; 
  JMPA CC_NZ,BB//
  BCLR Z//
  MOV R3,#2//
  JMPS CC//
BB:         //
  MOV R3,#4//; 以上为设置占空比0.25和0.5的间隔转换
CC:
  MOV R1,#FFFFH//
  MOV R2,T7REL//
  SUB R1,R2//
  MOV MDL,R1//
  DIVU R3//
  ADD MDL,T7REL//
  MOV CC16,MDL//;计算比较寄存器的值cc16=(2^16-T7REL)/R3+T7REL
  RETI

有写错的地方请帮我挑挑

  

相关帖子

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

本版积分规则

2

主题

4

帖子

0

粉丝