pin chnage interrupt maddness

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello

I am using a tiny26 & trying to use pin change interrupts on PA6.

I set GIMSK to $20 (PCIE1=1) & use the SEI instruction.
I am not getting into the interrupt routine for some reason. I tried setting the ACD bit in ACSR to zero as well (should be zero from power up)---no luck.
I am using the proper vector.

Now I DO seem to get into it at intiailization when I happen to be toggling some other I/O lines (I ultimately will check the ISR for PA6 being low & filter out these intruders)

I set DDRA to give PA6 as an input (bit=0)
I set Porta pa6 bit to both 1 & 0 with no difference

Now I do have some timer interrupts going on at the same time. I save & restore the SREG & do an RETI & this ISR seems to be fine.

Question: Will my timer ISR cause a pin change interrupt to be "lost"/missed
I do not do anything with the GIFR -PCIFflag register at all--to my understanding I don't need to fool with it????
what is consideed a pin change? I am assuming a single pin changing (PA6) will be enough to trigger the interrupt. The other lines may or may not be toggling (I plan to filter them out, since I want to execute the interrupt only when PA6 is going low).

For my testing I am tapping a wire to PA6 between high (5V) & low (gnd). Note it is likely this is happening during my timer ISR interrupt which happens at a fast rate. I also tried enabling interrupts within the timer ISR (using SEI)--again no luck.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Note that I am also using the A/D, but not AD5 which is PA6...I never set admux to this channel, but do set it to channels 0 & 8...Would using the A/D at all cause some type of problem?

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was going totally nutty--tried everything, then gave up. I decided that since I wanted PA6 to generate an interrupt I might be able to rig up the analog comparator to generate one (it has this ability & happens to connect to PA6). Well upon figuring out how to set up ACSR I noticed that ACD must be SET to 1 to DISABLE the analog comparator (when active it overrides the pin change interrupt function). Since I never used the analog compartor, I assumed it was off & not interfering. As part of my massive test I had written a zero to this ACD bit to endure it was off (which is really "on" & is also the default).
Once I relaized that the defualt is "on" & off is a level 1, I went back & retried my pin change interrupt--IT WORKS!! Why couldn't the data sheet simply say write a 1 to ACD in ACSR to disable this override? Would have saved many hours!

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!