ATTiny24 PWM and I2C

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

This is a question of can it be done and I'm not so familiar with the hardware to see the answer.

The basic question is, can I use PA6 for SDA (I2C/TWI) while using Timer1 in FAST PWM mode?

I'm assuming code will be needed to set and clear the pin where I want PWM to appear so I don't need the actual OCR1A output which maps to PA6. The data sheet doesn't quite seem to answer the question of what happens when you try to use TWI when the timer is in this mode, or at least I don't see it.

I'm sure there are other ways to solve the problem, but the question as posed is what interests me.

"It's easier to ask forgiveness than it is to get permission" - Admiral "Amazing" Grace Hopper.

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

Alternate pin function (especially on smaller devices where they are piled n deep) is always a challenge.

If you want to use SCL and SCA, then use OC1B for PWM.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Hi Lee,

Your suggestion does avoid the conflict, and if I hadn't been wearing mental blinders I might not have been concerned enough to raise the original question.

So, there is still in my mind the question of if one or the other function over rides use of the output, or if they fight and if some register setting would arbitrate.

"It's easier to ask forgiveness than it is to get permission" - Admiral "Amazing" Grace Hopper.

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

Quote:

So, there is still in my mind the question of if one or the other function over rides use of the output, or if they fight and if some register setting would arbitrate.

What does the datasheet say in the "Overriding Pin Functions" or like that table?

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.