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
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post

    And - yes - I know Mike will yell at me for suggestiing this, but I normally wait for the pin to return to the un-pressed state in my interrupt handler, then exit & clear the interrupt flag bit. It's just so much easier than sampling pins for a switch-press in a timer-based interrupt. But - Mike does have some cool stuff to do this if you're interested.
    !
    Great explanation, just one thing...

    [noob alert]

    Could you please give me an example of some code to implement the bolded bit above? (particularly the exiting sequence & clearing the interupt flag - can't say I've had to do that before)

    [/noob alert]

    Also, forgive me for asking - but have you a link to Mike's info that you referred to?

    Edit: remainder of post deleted cos I spotted a mistake & sorted it!
    Last edited by HankMcSpank; - 7th August 2010 at 00:16.

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


    Did you find this post helpful? Yes | No

    Default

    You already have the reset flag option enabled with DT_INTs, so you don't have to worry about the int flag being reset. It's just up-to-you to make sure it CAN reset the flag by first reading the port pins, and waiting, as in my example above, for whatever input pins you're using, to return to the non-pressed logic level.

    Just duplicate my example above for each pin. I'm going to make you figger that out on-you-own..

    Hint: Just replace PORTB.6 with whatever pin you need to test next. It's blazingly fast if a pin isn't at logic 0.

    Mike will have to help you on his end. He posts here reqularly with some very cool stuff, but you may have to convert it from C to PBP, which really isn't too hard since the C structure is darn close to BASIC (for very simple code).

    And, if you need it, I can do the translation for you, but I'll let Mike chime-in with here with his code example first. He's quite good. Right up there with Darell, and I learn a lot from his input...

    Edit: Make sure you have the latest/greatest version of DT_INTs. Looks like you may have an older version that doesn't have the newer int handlers.
    Last edited by Bruce; - 7th August 2010 at 00:18. Reason: YIKES.. Stop all the editing...;o)
    Regards,

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

  3. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Wow...great stuf - thanks.

    you'll be pleased to hear it's bedtime here in the UK, so radio silence falls upon this thread!

    You've been a great help, in closing re the IOC interupt config ....we were both wrong - I think (...though you were only one character out - I was way out!), the correct IOC config might be like this...???

    Code:
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   RBC_INT,  _ToggleLED1,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @ INT_ENABLE  RBC_INT     ; enable IOC interrupts
    Re having the latest DTS-14 files, they were downloaded from Darrel's site...

    http://darreltaylor.com/DT_INTS-14/downloads.htm (dated Jan 29 2006)

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


    Did you find this post helpful? Yes | No

    Default

    Also - just for the sake of other list members, you might want to just create a 2nd post, and leave whatever you had to change in the original.

    Just so folks can see where you made a mistake (if any), and learn from it. Rather than editing your previous post. I myself learn a lot from things that need to be changed to work properly, and it's a tad confusing for folks to follow-along if you edit a previous code example that needed changing.

    we were both wrong
    I don't think so. The 16F690 has different interrupt enable & flag bits for PORTA/PORTB interrupt-on-change.

    From DT_INTS-14;
    Code:
    #define RBC_INT      INTCON,RBIF,  INTCON,RBIE   ;-- RB Port Change
    These registers aren't available in the 16F690.

    These are;
    Code:
    #define RABC_INT     INTCON,RABIF, INTCON,RABIE  ;-- RAB Port Change     *
    Last edited by Bruce; - 7th August 2010 at 00:41.
    Regards,

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

  5. #5
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default

    Hey Bruce,

    Despite the very warm welcome from everyone here I feel that posting non-PBP examples isn't cool and probably is not helping anyone so perhaps it's best if I just stay on the sidelines and stop preaching (lol).

    Cheerful regards, Mike

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


    Did you find this post helpful? Yes | No

    Default

    Hi Mike,

    Sorry you feel that way, but i think everything you post has some benefit to some.

    Large portions of Darells' code that everyone uses BIG time here is in assembler, and that doesn't detract from its usefulness.
    Regards,

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

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


    Did you find this post helpful? Yes | No

    Default

    See if this works.
    Attached Files Attached Files
    Last edited by Bruce; - 7th August 2010 at 15:22.
    Regards,

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

  8. #8
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    See if this works.
    Bruce,

    Many thanks for the example - you're a diamond.

    Alas, it's not compiling on my PC - I'm certain that I've a parameter wrong somewhere or other on my machine, becuase after finishing posting last night such was my keeness, I spent another hour trying to get a very minimalist IOC test program to compile - & I was getting the same type of compilation errors.

    The errors I'm seeing (both last night & now with your program) are as follows....

    Error[128] [filepath]test_ioc.asm: Missing Arguments
    Error[113] [filepath]test_ioc.asm: Symbol not previously defined (IntFlagReg)
    Error[113] [filepath]test_ioc.asm: Symbol not previously defined (IntFlagBit)
    Error[101] [filepath]test_ioc.asm: ERROR (Interupt Source (IntFlagReg, IntFlagBit) not found



    If I remove the RABC_INT entry in in the interupt header & replace with INT_INT - it always compiles fine.

    Any tips greatfully received, as I'm not getting off the ground with this IOC melarkey (& I'm chomping at the bit to breadboard the MKII 'no diodes' puppy!)

    Many thanks once again.

    Hank.

    (PS I'm using V1.0 - the latest DTS-14.BAS)
    Last edited by HankMcSpank; - 7th August 2010 at 14:04.

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