Atmel ATSTK500 500 Starter kit and development system. ATSTK500 ATSTK500 Hoja De Datos

Los códigos de productos
ATSTK500
Descargar
Página de 31
29
AVR061
2525B–AVR–04/03
Writing the Lock Bits
if (number of lock bytes >= 1)
{
// Devices with selftimed SPI has another programming
// format for low lock bits than those without, apart from for ATtiny12 & 
ATtiny15
if ((device supports self-timing programming) && (device is not Attiny12 or 
Attiny15))
UniversalCommand(0xAC, 0xE0, 0, &lock_byte))
else
UniversalCommand(0xAC, lock_byte | 0xF9, 0, &dummy_var))
Sleep(50); // Wait for lock bit write operation in device to complete
}
Reading the Fuse Bits
// As mentioned, some parts combine Fuses and Locks in same byte on readback. 
// They have another programming format than those which don't.
if (part does not combine fuse and lock bits)
{
if (number of fuse bytes >= 1)
UniversalCommandNew(0x50, 0, 0, &low_fuse_byte);
if (number of fuse bytes >= 2)
UniversalCommandNew(0x58, 0x08, 0, &high_fuse_byte);
}
// Common Fuse and Lock bits. This is exactly like reading Lock bits, execept 
// that we pick another mask for getting the Fuse bits from the returned data.
// Note: The same masking of the data must be done when reading the Fuses
// in Parallell mode.
else if (part does combine fuse and lock bits)
{
if (number of lock bits are >= 1)
UniversalCommandNew(0x58, 0, 0, &low_fuse_byte);
low_fuse_byte |= 0xC0;// Set non-fuse bits to 1
}