interrupt help with HCS12

Discussion in 'General Electronics Chat' started by silvrstring, Jan 17, 2009.

  1. silvrstring

    Thread Starter Active Member

    Mar 27, 2008
    159
    0
    Hey all.

    I'm having trouble with interrupts on my hcs12 dragon12plus board. I'm trying to make a traffic light setup that will have a north/south 'walk' button and an east/west 'walk' button.

    I have it set up so the lights will change if a button is pressed, but I can't figure out how to differentiate between interrupts from pins on the same port that would require two different handlers. In other words, pressing the N/S button, or the E/W button, affects the light change whether it's needed, or not.

    Surprisingly, my text doesn't offer much help on multiple interrupts. Anybody have some examples of using 2 or more interrupts from the same port that require different ISRs? I attached what I have, if you want to look at it.

    Thanks,
    silvrstring
     
  2. duffy

    Active Member

    Dec 29, 2008
    44
    0
    For an interrupt-on-change, you read the port again, compare it to the previous value. The problem with doing an interrupt off a switch is usually the debounce.
     
  3. silvrstring

    Thread Starter Active Member

    Mar 27, 2008
    159
    0
    Thanks duffy,

    But I'm not sure what you mean. I'm having trouble with how to implement two different ISRs from the same port. Actually, just how to implement two different ISRs.

    Thanks for the debounce tip, but I did not include a debounce on purpose; I figured the less in the program, the more likely someone would actually read it. The delays should take care of it anyway. Besides, I don't intend to flip the switch very fast.

    Thanks, though.
    silvrstring
     
    Last edited: Jan 19, 2009
Loading...