ATtiny84, PCINT1_vect, Software Serial

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I have a routine running on an ATTiny84 the looks at pin change interrupts, calculates a frequency(RPM), measures temperature and toggles other output puts according to some logic. This works great.

 

Then I decided, wow, it would be great to see the state, temps and frequency.

 

So I wrote a bit of independent code that does the analog reads and outputs temps using softwareserial.

 

Software serial uses PCINT1 and I need PCINT1 to measure frequency, so these two bits of code won't compile together.

 

Everything with this case is happening pretty slowly, It would be perfectly fine to write out the stats I want every 5 seconds and shut down my PCINT1 while softwareserial is using PCINT1

 

The general routine I would like to be able to run:

  • my interrupts for a set period
  • then shut them off
  • start the softwareserial
  • output the data
  • end the serial
  • start my interrupts again

 

My question is, is there a way I can wrap my interrupt code with a conditional(like an if statement on a volatile variable) and get it inserted into the PCINT1_vect that the compiler is writing from the softwareserial?

 

And yes I did have to adjust OSCCAL to get the serial output to work reliably.

 

Thanks,

 

Bill

 

 

 

 

 

Bill