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


Results 1 to 40 of 68

Threaded View

  1. #22
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Hi Bruce,

    I'd not investigated IOC, cos I wasn't sure how to implement! (like I say - n00b alert!) I like the idea of saving 3 x diodes worth of pcb space!

    So, would it go something like thus....

    Code:
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
        INT_Handler    IOC_INT,  _Switch_Interupt,   PBP,  yes  
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE   IOC_INT     ; Enable 'Int On Change' interrupts
    ********************************************************************
    
    (main body of code)
    
    '********************************************************************
    Switch_Interupt:
    
    if portB.4 = 0 then  mode = 1
    if portB.5 = 0 then  mode = 2
    
    blah blah...
    
    @ INT_RETURN
    Quote Originally Posted by Mike, K8LH View Post
    That's what I thought you might be doin' (OR'ing active lo switch signals to trigger INT).

    Is there some compelling reason you're using interrupts for the switches instead of just polling them at regular intervals?
    Nothing other than wanting my unit's 'mode' to change the instant a switch is pressed. (what originated this thread, was I'd noticed that even holding a button down for a mere 200ms - to determine say mode 3 or mode 4 from one switch - seemed like a lifetime when playing a guitar, so polling three switches is just not gonna cut it - my code uses a whole heap of pauses in the main body of the program, this would hinder such polling)
    Last edited by HankMcSpank; - 6th August 2010 at 19:30.

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