USART control question


Closed Thread
Results 1 to 3 of 3
  1. #1

    Question USART control question

    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?

  2. #2

    Default Re: USART control question

    i have found that DATA = 0 is the problem i hope this helps anyone who has this problem.

  3. #3
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240

    Default Re: USART control question

    Quote Originally Posted by sburakguneri View Post
    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!
    Thanks and Regards;
    Gadelhas

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts