Hello,
Does anyone has information on how to read the MUI (Microchip Unique Identifier) on the Q41 Family?
Thanks in advance...
Sergio de la Peña
MUI (Microchip Unique Identifier)
Moderators: David Barker, Jerry Messina
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: MUI (Microchip Unique Identifier)
The DIA is located in the program memory space. Since it's read-only you should be able to access it using the TBLPTR like so:
Code: Select all
device = 18F16Q41
// read the Q41 DIA area located in program memory space
// MUI0-MUI8 (9 words, 18 bytes) from $2C0000-$2C0011
// set tableptr address
inline sub set_flash_addr(addr as longword)
TBLPTRU = addr.bytes(2)
TBLPTRH = addr.bytes(1)
TBLPTRL = addr.bytes(0)
end sub
// read byte at TBLPTR
inline function TBLRD_() as TABLAT
asm-
TBLRD*
end asm
end function
// read byte at TBLPTR and increment ptr
inline function TBLRD_POSTINC() as TABLAT
asm-
TBLRD*+
end asm
end function
dim mui(18) as byte
dim i as byte
// set tableptr to point to the Q41 MUI area
set_flash_addr($2C0000)
// read 18 bytes
for i = 0 to bound(mui)
mui(i) = TBLRD_POSTINC()
next
// must set TBLPTRU back to 0 when done
set_flash_addr(0)
Re: MUI (Microchip Unique Identifier)
Thanks Jerry, you are the Man!!!
Sergio
Sergio