Mcu status register – mcusr for the attiny12, Attiny12 internal voltage reference, Voltage reference enable signals and start-up time – Rainbow Electronics ATtiny12 User Manual

Page 24: Attiny11/12

Advertising
background image

24

ATtiny11/12

1006C–09/01

MCU Status Register –
MCUSR for the ATtiny12

The MCU Status Register provides information on which reset source caused an MCU
reset.

• Bit 7..4 - Res: Reserved Bits

These bits are reserved bits in the ATtiny12 and always read as zero.

• Bit 3 - WDRF: Watchdog Reset Flag

This bit is set if a watchdog reset occurs. The bit is reset by a power-on reset, or by writ-
ing a logic zero to the flag.

• Bit 2 - BORF: Brown-out Reset Flag

This bit is set if a brown-out reset occurs. The bit is reset by a power-on reset, or by writ-
ing a logic zero to the flag.

• Bit 1 - EXTRF: EXTernal Reset Flag

This bit is set if an external reset occurs. The bit is reset by a power-on reset, or by writ-
ing a logic zero to the flag.

• Bit 0 - PORF: Power-on Reset Flag

This bit is set if a power-on reset occurs. The bit is reset by writing a logic zero to the
flag.

To use the reset flags to identify a reset condition, the user should read and then reset
the MCUSR as early as possible in the program. If the register is cleared before another
reset occurs, the source of the reset can be found by examining the reset flags.

ATtiny12 Internal Voltage
Reference

ATtiny12 features an internal voltage reference with a nominal voltage of 1.22V. This
reference is used for Brown-out Detection, and it can be used as an input to the Analog
Comparator.

Voltage Reference Enable
Signals and Start-up Time

The voltage reference has a start-up time that may influence the way it should be used.
The maximum start-up time is 10µs. To save power, the reference is not always turned
on. The reference is on during the following situations:

1.

When BOD is enabled (by programming the BODEN fuse)

2.

When the bandgap reference is connected to the Analog Comparator (by setting
the AINBG bit in ACSR)

Thus, when BOD is not enabled, after setting the AINBG bit, the user must always allow
the reference to start up before the output from the Analog Comparator is used. The

Table 12. Reset Source Identification

EXTRF

PORF

Reset Source

0

0

Watchdog Reset

1

0

External Reset

0

1

Power-on Reset

1

1

Power-on Reset

Bit

7

6

5

4

3

2

1

0

$34

-

-

-

-

WDRF

BORF

EXTRF

PORF

MCUSR

Read/Write

R

R

R

R

R/W

R/W

R/W

R/W

Initial Value

0

0

0

0

See Bit Description

Advertising