Page 1 of 1

MUI (Microchip Unique Identifier)

Posted: Mon May 30, 2022 7:51 pm
by animo3d
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

Re: MUI (Microchip Unique Identifier)

Posted: Tue May 31, 2022 11:22 am
by Jerry Messina
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)

Posted: Tue May 31, 2022 5:33 pm
by animo3d
Thanks Jerry, you are the Man!!!

Sergio