[Icc-avr] Reading fuses on Mega168
Ian
ianjames at waitrose.com
Tue Apr 29 06:28:43 PDT 2008
Hi Johan,
I see your point so I changed the code thus:
; 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 high fuses bits
; dbg[2] = readfusesbyte(SPMCSR,0x0003);
ldi R18,3
ldi R19,0
in R16,0x37
clr R17
xcall _readfusesbyte
sts _dbg+2,R16
.dbline 30
Still the same problem, the first example uses ldi instructions to load
R16/17 with 87
whereas the second example uses in instruction to load 0x37 into R16 and
clrs R17.
The actual definition of SPMSCR is
#define SPMCSR (*(volatile unsigned char *)0x57)
which for some strange reason the compiler translates to 0x37.
Regard,
Ian James
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the Icc-avr
mailing list