New (old?) bug in M48 headers?

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
	// enable the ocr1a interrupt
	TIMSK1 = 1<<OCIE1A; // <--- this doesn't work; equates to 0x04. BUG!
 12a:	84 e0       	ldi	r24, 0x04	; 4
 12c:	80 93 6f 00 	sts	0x006F, r24
	//TIMSK1 = 0x02;

Using OCIE1A in the program results in a value of 0x02 for the bit name, should be 0x01.

That caused a little headscratching - as far as I can see that's with the WinAVR version 20040720 (from the readme). At a quick look though I haven't found the headers being used... it's ok in the Program Files/Atmel/AvrAssembler/Appnotes/m48def.inc.

The AVR Studio version is 4.13 build 528, if that's any help.

Neil

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

The AVR Studio version and files like Program Files/Atmel/AvrAssembler/Appnotes/m48def.inc are outside of the gcc toolchain. If your WinAVR version is really 20040720, you should really upgrade. There's bound to be other bugs as well. For the latest version of avr-libc (part of WinAVR), the relevant include file is avr/iomx8.h. From that include file, it looks correct:

#define TIMSK1  _SFR_MEM8 (0x6F)
/* TIMSK1 */
#define ICIE1   5
#define OCIE1B  2
#define OCIE1A  1
#define TOIE1   0

Are you sure you have the AVR part defined correctly in your makefile or avr project configuration?

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

Quote:
as far as I can see that's with the WinAVR version 20040720 (from the readme)

You know this is a 4 year old version?
And yes, it is an old bug which was fixed "recently" (Sep 2004).

Stefan Ernst

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

Thanks guys - I figured it probably had. Time to get a new version. As it happens I haven't had to compile that flag for an M48 before :mrgreen: