[Icc-avr] Reading fuses on Mega168

Ian ianjames at waitrose.com
Tue Apr 29 01:31:41 PDT 2008


Hi,

Following on from my previous post regarding reading fuses on the Mega168  
I have found that passing the value 0x57 to the function readfusesbyte  
[unsigned char readfusesbyte(unsigned int ioaddr, unsigned int fuseaddr);]  
results in this:

;   dbg[0] = readfusesbyte(0x57,0x0001);
	ldi R18,1
	ldi R19,0
	ldi R16,87
	ldi R17,0

where as passing the value SPMCSR results in this:

;   dbg[1] = readfusesbyte(SPMCSR,0x0000);
	clr R18
	clr R19
	in R16,0x37
	clr R17


where SPMCSR is defined as

/* SPM Control and Status Register */
#define SPMCSR	(*(volatile unsigned char *)0x57)

Can anyone shed any light on the anomaly?.

I have included a partial copy of the .s file thus:

; unsigned char readfusesbyte(unsigned int ioaddr, unsigned int fuseaddr);
;
; void ReadFuseLock(void)
; {				
	.dbline 22
;  _CLI();
	cli
	.dbline 24
;   // Read lock bits
;   dbg[0] = readfusesbyte(0x57,0x0001);
	ldi R18,1
	ldi R19,0
	ldi R16,87
	ldi R17,0
	xcall _readfusesbyte
	sts _dbg,R16
	.dbline 27
; 		
;   // Read low fuses bits
;   dbg[1] = readfusesbyte(SPMCSR,0x0000);
	clr R18
	clr R19
	in R16,0x37
	clr R17
	xcall _readfusesbyte
	sts _dbg+1,R16
	.dbline 30

I would be grateful for an explaination as I am wondering if there are any  
other potential anomolies I should know about.

Regards,

Ian James


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the Icc-avr mailing list