PDA

View Full Version : USART control question



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?

sburakguneri
- 3rd June 2011, 20:01
i have found that DATA = 0 is the problem :) i hope this helps anyone who has this problem.

gadelhas
- 3rd June 2011, 20:06
i have found that DATA = 0 is the problem :) i hope this helps anyone who has this problem.

You cannot use the word "Data". DATA is a command to store constants in on-chip non-volatile EEPROM. YOu can see that in the PBP Manual!