user68914: I am trying to figure out if I can measure the Vcc of attiny13a, but the code I use for arduino's and attiny85 does not work. This is where I got the code from. I know that it works by using the 1.1v reference and the ADC, and in the attiny13a datasheet it says that it has these, but I can't get it to work.

user7508: The code you linked to measures the 1.1 V internal reference using
Vcc as a reference. The ATtiny13A cannot do that. It does have a 1.1 V
internal reference, but it can only use it as a reference for the ADC,
not as a measured channel.
What you can do, if you don't mind adding extra hardware, is divide Vcc
with some resistors in order to get a voltage proportional to Vcc but
lower than 1.1 V. Then use the 1.1 V reference to measure that
voltage. In other words, measure a scaled-down Vcc against the
1.1 V reference instead of measuring the 1.1 V reference
against Vcc. The datasheet should help you with the details.

68914: <p>I am trying to figure out if I can measure the Vcc of attiny13a, but the code I use for arduino's and attiny85 does not work. <a href="https://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/" rel="nofollow noreferrer">This is where I got the code from.</a> I know that it works by using the 1.1v reference and the ADC, and in the attiny13a datasheet it says that it has these, but I can't get it to work.</p>
 7508: <p>The code you linked to measures the 1.1 V internal reference using
Vcc as a reference. The ATtiny13A cannot do that. It does have a 1.1 V
internal reference, but it can only use it as a reference for the ADC,
not as a measured channel.</p>
<p>What you can do, if you don't mind adding extra hardware, is divide Vcc
with some resistors in order to get a voltage proportional to Vcc but
lower than 1.1 V. Then use the 1.1 V reference to measure that
voltage. In other words, measure a scaled-down Vcc against the
1.1 V reference instead of measuring the 1.1 V reference
against Vcc. The datasheet should help you with the details.</p>
