|
发表于 26-2-2008 12:28 PM
|
显示全部楼层
|
|
|
|
|
|
|
楼主 |
发表于 3-3-2008 10:32 AM
|
显示全部楼层
我想问这个 software 有问题吗?
这是一个pic control motor function (但用 5v relay 来控制 )
portC 2 和 portC 3 is to dectect input to control motor forward or reverse.
port B 2 - alway turn on motor.
portB 6 - turn on motor reverse.
portB 5 - turn on motor forward.
portB 7 - turn on motor reverse.
portB 2 is control one motor.
portB 6 is control one motor.
portB 5 和 portB 7 是 share one motor.
main
CLRF 0X50
CLRF 0X57
CLRF 0X53
CLRW
BSF STATUS, RP0
MOVLW 0XFF
MOVWF TRISC
MOVLW 0X00
MOVWF TRISB
BCF STATUS, RP0
BSF PORTB,2
ROTATE
BCF PORTB,7
BSF PORTB,5
BSF PORTB,6
DECTECT
MOVF PORTC,W
MOVWF 0X53
BTFSC 0X53,2
CALL REVERSE
BTFSC 0X53,3
CALL REVERSE
GOTO DECTECT
REVERSE
BCF PORTB,5
BSF PORTB,7
BSF PORTB,6
CALL DELAY
DECTECT_REV
MOVF PORTC,W
MOVWF 0X53
BTFSC 0X53,2
CALL DECTECT_REV
BTFSC 0X53,3
CALL DECTECT_REV
CALL ROTATE
DELAY
MOVLW D'10' ; 1 cycle
MOVWF DELAYADD ; 1 cycle
DELAY_LOOP
DECFSZ DELAYADD, F ; 1 cycle
GOTO DELAY_LOOP ; 2 cycles
RETURN ; 2 cycles
END
谢谢帮忙。
因为用时会 intermedia.
可能是 go in sub-routine 有问题。。。。? |
|
|
|
|
|
|
|
发表于 5-3-2008 02:43 PM
|
显示全部楼层
|
|
|
|
|
|
| |
本周最热论坛帖子
|