打印

12f629的问题

[复制链接]
2883|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
chen3bing|  楼主 | 2007-10-23 20:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
ov, IO, go, gp, hm
 我用12F629写了一个产生30秒脉冲波的程序。

GP3脚接一个按键,按下之后,在GP0脚上产生一个

30秒钟周期为250毫秒的脉冲波。

可是按键按下之后,只产生一个周期的脉冲波。

请高手指教。程序如下:

trisio   equ   85h
option_reg equ 81h
wpu      equ   95h
tmr0     equ   01h
status   EQU   03H
gpio     EQU   05H
intcon   equ   0bh
cmcon    equ   19h
rp0      equ   5h
rp1      equ   6h
c        equ   0
data1    equ   7h
data2    equ   8h
count1   equ   9h
count2   equ   11h

org   00h
main  nop
      bcf     status,rp0
      bcf     status,rp1
      movlw   1fh
      movwf   cmcon
      bsf     status,rp0
      bcf     status,rp1
      
      movlw   08h       ;5入0出
      movwf   trisio
      movlw   37h
      movwf   wpu
      bcf     status,rp0
      clrf    gpio
      movlw   01h           ;5高电平
      movwf   gpio
      clrf    intcon
      ;goto    $
check btfss   gpio,3
      goto    check
      call    delay
      btfss   gpio,3
      goto    check
chshh 
      clrf    count1
      clrf    count2
      ;clrf    tmr0
      MOVLW   0ch
      MOVWF   tmr0
      movlw   87h
      movwf   option_reg
del30 movlw   0ffh
      subwf   tmr0,0
      btfss   status,c
      goto    del30
      clrwdt
      movlw   0ch
      movwf   tmr0        ;
      incf    count1,1
      movlw   02h          
      subwf   count1,0
      btfss   status,c
      goto    del30
      clrf    count1            ;125ms
      movlw   01h
      xorwf   gpio,1
      incf    count2,1
      movlw   0f0h
      subwf   count2,0
      btfss   status,c
      goto    del30
      clrf    count2
      movlw   01h
      movwf   gpio
      goto    check
     ;goto     $
      

      
delay movlw   0dh
      movwf   data1
lp0   movlw   0ffh
      movwf   data2
lp1   decfsz  data2,1
      goto    lp1
      decfsz  data1,1
      goto    lp0
      return
      end         

 
 
 
沙发
LXRLXR| | 2007-10-24 10:38 | 只看该作者

不习惯小写,再加点注释吧

使用特权

评论回复
板凳
chen3bing|  楼主 | 2007-10-24 17:43 | 只看该作者

谢谢

问题解决了,是硬件的毛病。

使用特权

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

本版积分规则

439

主题

2539

帖子

2

粉丝