do I need an interrupt?


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Just a pointer

    OK, do a search for Timer interrupt first. in the interrupt routine you'll have to determine:
    1. i'm i on the HIGH pulse?... since how may time? enough? if so do the low pulse
    2. same as 1 for low pulse

    try it. If there's any other problem, i see some method.

    OR do a short pause loop, check the pin state in the loop.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    what I did was

    START:
    IF PORTB.0 = 0 THEN START

    WORK:
    DO SOMETHING HERE & THERE 'this takes 250ms to complete
    LET X = X + 1
    IF X > 333 THEN GOSUB GOHIGH
    IF PORTB.0 = 0 THEN START
    GOTO WORK

    GOHIGH:
    HIGH PORTC.3
    PAUSE 500
    LOW PORTC.3
    LET X = 0
    RETURN

    So, after about 3 seconds my port goes high for 500ms but I still have a 500ms + 250ms = 750ms gap where my inputs are ignored. A 555 one-shot would work fine but I want to avoid adding more circuitry if possible.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink And with a little " RTFM " ??????

    Hi,

    As all your inputs are on PortB ... why not use the simple feature " interrupt on PortB change " ???

    you just have to check which input caused the interrupt and do what needed ...

    That would not disturb your PWM sections nor make great changes to your tempo's, even if a basic interrupt used.

    ( note it's an Excellent excercise for trying Darrel's Instant interrupts, too ... )

    just change PAUSE 500 to

    For i = 1 to 500
    PAUSE 1
    Next i

    ... as stated in the MANUAL, Basic interrupts section ....


    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 09:00
  2. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 02:35
  3. Help with Analog Interrupt
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 18:14
  4. NEWBIE: Some basic questions using interrupts
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2006, 02:59
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

Members who have read this thread : 0

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