sburakguneri
- 3rd June 2011, 17:57
hi friends, i have a problem. i'm trying to control a motor using USART interrupt. my program is like this;
(after definings...)
START:
IF DATA="A" THEN
MOTOR1=1
MOTOR2=0 'motor1 and motor2 are the control
'terminals of L298n motor driver
DATA=0
ENDIF
IF DATA="B" THEN
MOTOR1=0
MOTOR2=1
DATA=0
ENDIF
GOTO START
DISABLE
INT: 'this is the interrupt program
GIE=0
hSerIn , [WAIT ("1MR"),RX]
DATA=RX
TEMP=RCREG
RCIF=0
GIE=1
RESUME
ENABLE
END
With this program my motor runs for one or two seconds after that the motor stops itself. Do you have any idea what the problem is?
(after definings...)
START:
IF DATA="A" THEN
MOTOR1=1
MOTOR2=0 'motor1 and motor2 are the control
'terminals of L298n motor driver
DATA=0
ENDIF
IF DATA="B" THEN
MOTOR1=0
MOTOR2=1
DATA=0
ENDIF
GOTO START
DISABLE
INT: 'this is the interrupt program
GIE=0
hSerIn , [WAIT ("1MR"),RX]
DATA=RX
TEMP=RCREG
RCIF=0
GIE=1
RESUME
ENABLE
END
With this program my motor runs for one or two seconds after that the motor stops itself. Do you have any idea what the problem is?