[Icc-avr] Reading Fuses on Mega88

Richard richard-lists at imagecraft.com
Thu Nov 29 04:29:37 PST 2007


Since "ptr" is just allocated to a normal register set or on stack, 
the *ptr probably took more than 3/4 cycles with the LPM. It may be 
best to use inline asm or an asm module for this.

At 03:31 AM 11/29/2007, Ian wrote:
>Does anyone know how to read fuses on a mega88?
>
>I have tried the following but the results are incorrect.
>
>void ReadFuseLock(void)
>{
>   const unsigned char* ptr;
>   unsigned char Fuse[4];
>
>   // Read lock bits
>   SPMCSR = 0x09;        //  (BLBSET | SPMEN) to read fuse and lock bits
>   ptr = (const unsigned char*)(0x0001); // 0x0001 to read lock bits
>   Fuse[0]=*ptr;
>
>   // Read fuse low bits
>   SPMCSR = 0x09;
>   ptr = (const unsigned char*)(0x0000);
>   Fuse[1]=*ptr;
>
>   // Read fuse high bits
>   SPMCSR = 0x09;
>   ptr = (const unsigned char*)(0x0003);
>   Fuse[2]=*ptr;
>  }

// richard (This email is for mailing lists. To reach me directly, 
please use richard at imagecraft.com) 



More information about the Icc-avr mailing list