Need 4 modes with just 3 switches - need all modes to be selectable QUICKLY!


Closed Thread
Results 1 to 40 of 68

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Ok. This one blinks immediately, it's 133 words smaller, and a lot faster than the last...

    Edit: I don't see why your own version wouldn't work too, but you'll need to sort out the interrupt-on-release.
    Attached Files Attached Files
    Last edited by Bruce; - 7th August 2010 at 21:54.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Ok. This one blinks immediately, it's 133 words smaller, and a lot faster than the last...

    Edit: I don't see why your own version wouldn't work too, but you'll need to sort out the interrupt-on-release.
    -wow Bruce, what can I say ....that nailed the puppy - my leds are positively zippy now (they light before I've even pressed the switch - and they know which switch I'm going to press...like I say you're good!)

    Can't thank you enough - to paraphrase the woman in Poltergeist "This thread is cleeeeaaan"

    ....no more questions your honour.

    Now, back to PCB layouts....wow, look at all the new space I now have!

  3. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Ok....experiencing a few diffs here.

    Basically I need IOC interupts (which I'm basing on a simpler cut down noobesque version of excellent Bruce's provided code)...but I also need timer interupts.

    My problem is that I get a boat load of errors when my program compiles when IOC & timer interupts are enabled together - what are the errors I hear you say? Well, I'm at work right now so can't cut/paste in what I'm seeing, but what I can say is that when I remove the timer interupt it compiles fine. Or when I remove the IOC interupt it compiles fine - only when both are enabled does it spew out heaps of errors during compilation.

    I also know that my overall code is fine - previously I was using the INT pin for interupts ...I was able to get both INT & Timer interupts enabled & working in that setup. So I'm figuring here that maybe this latest way of handling the switches - IOC interupts - are using up a whole lot more PIC resource than the previous way I was doing this? Maybe the combinbation of IOC interupts, timer interupts, plus my coat are pushing things too far?

    How to progress this?

  4. #4
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Ok, I'm home now.....here are the compile errors...

    Error[116] : Address label duplicated or different in second pass (_305AfterUserRoutine)
    Error[116] : Address label duplicated or different in second pass (_305NoInt)
    Error[116] : Address label duplicated or different in second pass (INT_EXIT)
    Error[116] : Address label duplicated or different in second pass (_290OverCREATE)
    Error[116] : Address label duplicated or different in second pass (L00001)
    Error[116] : Address label duplicated or different in second pass (L00002)
    Error[116] : Address label duplicated or different in second pass (L00003)


    .....and so on.

    Like I say I think it's to do with both interupt handlers being enabled?

    Which prompts me, how should two interupt handlers be coded wrt 'returns'. Should it look like this (wrt IOC Interupts, I've stripped it back to basics & removed the disabling/enabling in the interupt handler here.... just for easiness on the eye)

    Code:
    LED1   VAR  PORTB.1
    
    INCLUDE "DT_INTS-14.bas"     ' Base Interrupt System
    INCLUDE "ReEnterPBP.bas"     ' Include if using PBP interrupts
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler  RABC_INT,  _Switch_Interupt,   PBP,  no
            INT_Handler   TMR1_INT,  _ToggleLED1,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    T1CON = $31                ; Prescaler = 8, TMR1ON
    @ INT_ENABLE  TMR1_INT     ; enable Timer 1 interrupts
    @ INT_ENABLE RABC_INT 
    
    Main:
      PAUSE 1
    GOTO Main
    
    '---[TMR1 - interrupt handler]--------------------------------------------------
    ToggleLED1:
         TOGGLE LED1
    @ INT_RETURN
    
    '---[ioc Interupt Handler]------------------------------------------------------
    Switch_Interupt:
    TOGGLE LED2
    @ INT_RETURN

    Many thanks.
    Last edited by HankMcSpank; - 12th August 2010 at 18:52.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Is that the whole program?

    The errors seem to indicate there's another INT_CREATE somewhere.
    DT

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


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by Darrel Taylor View Post
    Is that the whole program?

    The errors seem to indicate there's another INT_CREATE somewhere.
    Hi, Darrel

    May be not it here, but ...

    Do you remember those errors also appeared in MPLAB 8.30 ( ? ), when PBP 2.50 was released ???
    ( was necessary to twist the Project/Build options/project/settings :" -ampasmwin -k#" )

    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 " !!!
    *****************************************

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Do you remember those errors also appeared in MPLAB 8.30 ( ? ), when PBP 2.50 was released ???
    Thought about that, but it only affected DT_INTS-18.
    He's using -14 here.

    And as shown, it compiles without error here on a 16F690.
    PBP2.60A
    MPASM 5.36 from MPLAB 8.53, using MCS+.
    DT

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