для ATMEGA в IAR делал так
#include <inavr.h>
#define _GET_LOCK_BITS() __AddrToZByteToSPMCR_LPM( (void __flash *) 0x0001, 0x09 ) #define _GET_LOW_FUSES() __AddrToZByteToSPMCR_LPM( (void __flash *) 0x0000, 0x09 ) #define _GET_HIGH_FUSES() __AddrToZByteToSPMCR_LPM( (void __flash *) 0x0003, 0x09 ) #define _GET_EXTENDED_FUSES() __AddrToZByteToSPMCR_LPM( (void __flash *) 0x0002, 0x09 ) #define _SET_LOCK_BITS(data) __DataToR0ByteToSPMCR_SPM( data, 0x09 ) #define _ENABLE_RWW_SECTION() __DataToR0ByteToSPMCR_SPM( 0x00, 0x11 )
#define _WAIT_FOR_SPM() while( SPMCR_REG & (1<<SPMEN) );
// Read lock bits. _WAIT_FOR_SPM(); sendchar( _GET_LOCK_BITS() );
// Read fuse bits. _WAIT_FOR_SPM(); sendchar( _GET_LOW_FUSES() );
// Read high fuse bits. _WAIT_FOR_SPM(); sendchar( _GET_HIGH_FUSES() );
// Read extended fuse bits. _WAIT_FOR_SPM(); sendchar( _GET_EXTENDED_FUSES() );
|