Rac_int


Closed Thread
Results 1 to 3 of 3

Thread: Rac_int

  1. #1
    Join Date
    Jun 2006
    Posts
    60

    Default Rac_int

    The interrupt works perfect but if I hold the button down for a little while then let up the interrupt will hang, but if you just wait it will come out of it and start working again.Using a 16F688.
    Code:
    define OSC 4
    INCLUDE "DT_INTS-14.bas"     ' Base Interrupt System
    include "ReEnterPBP.bas"
    @ ERRORLEVEL -306   ; turn off crossing page boundary message
    
    '-----------------------REGISTERS----------------------------------------
    
    TRISA=%111000                                                   ' RA3,RA4,RA5 inputs
    ANSEL=%00000000                                                 ' All digital
    TRISC=%00000011                                                 ' RC0,RC1, input 
    CMCON0=%111                                                     ' Shut off comparators
    ;OPTION_REG.7=0
    WPUA=%111000                                                    ' Weak Pull Ups Enabled
    INTCON.7=1         'Enable Global Interrupts
    IOCA=%110000       'Enable IOC
    'Variables---------------------------------------------------------------------
    Forward var PORTC.0
    ForwardBut var PORTA.4
    Reversed var PORTC.1
    ReverseBut var PORTA.5
    Led var PORTC.2
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    RAC_INT,  _Motor,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    
        INT_ENABLE   RAC_INT    ; enable ioc
     ENDASM
    
    
    Main:
     high led
     pause 200
     low led
     pause 200
     goto main
    
    Motor:
     if ForwardBut=0 then
     high forward
     pause 100
     do while ForwardBut=0
     loop 
     low forward
     endif
     
     if ReverseBut=0 then
     high reversed
     pause 100
     do while ReverseBut=0
     loop
     low reversed
     endif
     @ INT_RETURN

  2. #2
    Join Date
    Jun 2006
    Posts
    60


    Did you find this post helpful? Yes | No

    Default Re: Rac_int

    I wasn't clear, if I push the button and release it all works fine. Just when I hold it for say 30 seconds it will freeze up as stated.

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,601


    Did you find this post helpful? Yes | No

    Default Re: Rac_int

    I wouldn't pause and loop until the button is released within the interrupt.

    I'd set a flag and handle it back in main logic.

    Robert

Similar Threads

  1. RAC_INT and pic 16F684
    By aratti in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd February 2013, 15:15
  2. Problem with RAC_INT
    By Dick Ivers in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th March 2010, 15:15

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