登录 免费注册 首页 | 行业黑名单 | 帮助
维库电子市场网
技术交流 | 电路欣赏 | 工控天地 | 数字广电 | 通信技术 | 电源技术 | 测控之家 | EMC技术 | ARM技术 | EDA技术 | PCB技术 | 嵌入式系统
驱动编程 | 集成电路 | 器件替换 | 模拟技术 | 新手园地 | 单 片 机 | DSP技术 | MCU技术 | IC 设计 | IC 产业 | CAN-bus/DeviceNe

这是根据霍尔信号输出PWM波的程序,还有点错误,找不出。

作者:libin5337 栏目:单片机
这是根据霍尔信号输出PWM波的程序,还有点错误,找不出。
list p=16F73
  #include <p16F73.inc>
  cblock 0x20
state1
state2
state3
delay
w_stack
st_stack
   ENDC
and=0xe0
      ORG 0x00
      goto start
      ORG 0x04
      btfss INTCON ,RBIF
      goto SAMPLErb
       RETFIE
start:
      bsf STATUS,RP0
      movlw 0xff
      movwf PORTC
      bsf  STATUS,RP0
      movlw 0x02
      movwf TRISC
      clrf PIR1
      clrf INTCON
      movlw 0x01
      movwf T2CON
      movlw 0x40
      movwf CCPR1L
      movlw 0xff
      movwf CCP1CON
      clrf TMR2
      movlw 0xed
      movwf TRISB
      movlw 0xc7
      movwf PR2
      bsf OPTION_REG,INTEDG
      bcf STATUS,RP0
      call SAMPLE
      movlw 0xd8
      movwf INTCON
      bsf T2CON, TMR2ON
      nop
SAMPLE:
      movlw and
      andwf PORTB,0
      movwf state1
      movlw 0x08
      movwf delay
del1:
      decfsz delay,1
      goto del1
      movlw and
      andwf PORTB, 0
      movwf state2
      xorwf state1,0
      btfsc STATUS,Z
      return
      movlw 0x06
      movwf delay
del2:
      decfsz delay,1
      goto del2
      movlw and
      andwf PORTB,0
      movwf state3
      xorwf state1,0
      btfsc STATUS,Z
      return
      movf state2,0
      xorwf state3,0
      btfss STATUS,Z
      goto SAMPLE
      movf state2,0
      movwf state1
      return
out:
      swapf state1,1
      bcf STATUS,C
      rrf state1,0
      call out_table
       return
SAMPLErb:
      call PUSH
      bcf STATUS,RP0
      call SAMPLE
      call out
      bcf INTCON, RBIF
      retfie
PUSH:
      movwf w_stack
      movf STATUS,0
      movwf st_stack
        return
pop:
      movf st_stack,0
      movwf STATUS
      movf w_stack,0
      return

    ORG 0x70
out_table:
    addwf pclath, 1
    retlw  0xca
    retlw  0xb2
    retlw  0xd2
    retlw  0x63
    retlw  0x6a
    retlw  0xa3
    end
     Register in operand not in bank 0.  Ensure that bank bits are correct.
Message[302] E:\LI\CHENG XU\UNTITLED.ASM 35 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Message[302] E:\LI\CHENG XU\UNTITLED.ASM 37 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Message[302] E:\LI\CHENG XU\UNTITLED.ASM 38 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Error[113]   E:\LI\CHENG XU\UNTITLED.ASM 104 : Symbol not previously defined (pclath)
Halting build on first failure as requested.



2楼: >>参与讨论
xieyuanbin
PCLATH用大写试试.
其它都是正常提示,只要你认为正确就不必理会.
MPLAB默认是区分大小写的.

3楼: >>参与讨论
libin5337
谢谢了。思路有没有问题啊 。大哥
 
4楼: >>参与讨论
xieyuanbin
一个注释都没有,没法看.
养成好习惯.也许你记得你编的第一个程序,但当程序多的时候,你甚至一天前的程序都看不懂.

参与讨论
昵称:
讨论内容:
 
 
相关帖子
PIC12F629什么价格?我在上海,每月1K用量(可能多点)。
定义的一个数组存储数据没去修改数据时,数据也会自己在变化
PIC12F675在73度左右内部看门狗就不工作了
求电动车无刷控制器原程序
PIC菜鸟请教拉!
免费注册为维库电子开发网会员,参与电子工程师社区讨论,点此进入


Copyright © 1998-2006 www.dzsc.com 浙ICP证030469号