Error message? Where from? I just change the code, compile and write it to the chip - other than build errors there is nothing in my toolchain that can provide any kind of error message. When setting (1<<0x02) in ADMUX ADC2 on PB4 works; when setting (1<<MUX2) instead it doesn't.
Some cores allow you to print to the serial console from an attiny85. You may have to reduce your code to the basics necessary to demonstrate the problem.
Other than swapping (1<<0x02) to (1<<MUX2) I make no other change. This stops ADC2 from capturing any values. The rest of the code still works. I hoped perhaps someone would recognise this issue. Seems quite odd.
So, nothing? I tried changing it to a known working macro:
$(warning OCIE0B is $(OCIE0B))
but still nothing:
Makefile:30: OCIE0B is
I know that OCIE0B is 0x03 because my TIMER1_COMPB_vect ISR fires correctly, so I'm probably not printing this correctly? If I put the #warning in my c file:
I'm using plain AVR c. I realise this means I'm in the wrong forum, but I thought I'd take the chance that someone might recognise the issue regardless.
Edit: Uuuuh... how do you set the other three to 0? Other than computing the whole register value and doing e.g. `ADMUX = 0x92;"? I always thought not setting a bit would mean it is zero?
If I read that correctly, to use internal 2.65 V reference without external capacitor and enable ADC channel #2 I should set the following bits (yes, they are in a weird order):
Or in other words 0b10010100, or 0x94. But this does not work. Curiously this has MUX2 defined as 4, while iotn85.h defines it as 2. Setting ADMUX to 0x92 does indeed work the same as my earlier configuration. Am I reading the datasheet incorrectly?