ashaw596 / arduino-tiny

Automatically exported from code.google.com/p/arduino-tiny
Other
0 stars 0 forks source link

WDTCR is not defined for attiny44, attiny84, only for attiny45, attiny85 #68

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try using WDTC in your attiny84 project
2. Compile
3. You'll get an undefined compiler message for WDTCR

I have to add:

#ifndef WDTCR // Missing for attiny44, 84
#define WDTCR   _SFR_IO8(0x21)
#endif

to work around this issue.

What version of the product are you using? On what operating system?

Latest attiny and arduino 1.0.1 on Ubuntu 32bit

Please provide any additional information below.

Original issue reported on code.google.com by tvijlbr...@gmail.com on 12 Sep 2012 at 6:31

GoogleCodeExporter commented 8 years ago
Attached .ino example

Note that this will compile because of my WDTCR definition.

Compiling for attiny45 does NOT need the definition, only attiny44, attiny84  
will fail

Original comment by tvijlbr...@gmail.com on 12 Sep 2012 at 6:54

Attachments:

GoogleCodeExporter commented 8 years ago
Three things...

1. This has nothing to do with the Tiny Core.  The register / macro definitions 
are provided by AVR Libc.

2. The register / macro definitions are based on the Atmel datasheets.  The 
register is named WDTCR for the X5 family and WDTCSR for the X4 family.

3. Libc provides processor agnostic macros (_WD_CONTROL_REG and 
_WD_CHANGE_BIT).  I suggest you use those.  Or, use the high-level Libc 
macros...
http://www.nongnu.org/avr-libc/user-manual/group__avr__watchdog.html

Original comment by arduino....@gmail.com on 12 Sep 2012 at 7:36

GoogleCodeExporter commented 8 years ago
Clear, thanks for the feedback!

_WD_CONTROL_REG works fine

Original comment by tvijlbr...@gmail.com on 13 Sep 2012 at 5:00