This code example uses the memory driver generated with the MPLAB® Code Configurator (MCC) Melody library to read the MUI. The MUI is a unique number that is encoded individually during final manufacturing on every device. This allows for unique device tracking by the application manufacturer.
- MPLAB® X IDE 6.10.0 or newer
- MPLAB® XC8 2.41 or newer compiler
- MPLAB® Code Configurator (MCC) 5.3.7 or newer
- Microchip PIC16F1xxxx_DFP Device Support (1.18.352) or newer
- MPLAB® Melody Library 2.6.1 or newer (microchip.com/mplab/mplab-code-configurator)
- PIC16F18076 Curiosity Nano (EV53Z50A)
The PIC16F18076 Curiosity Nano Development board is used as the test platform. This board has an onboard programmer/debugger and is equipped with a virtual serial port.
The following configurations must be made for this project:
Pin | Configuration |
---|---|
RB4 | UART TX pin |
RA1 | Digital output for LED |
RA0 | Digital input for Switch |
This application uses the Memory and UART drivers. The following screenshots illustrate the settings from MCC.
Note: Considering the PIC16F18076 configuration settings, check if this step appears as optional. This step is implemented because the PIC default clock is set as an external clock, meaning that the device may not possess a clock on start-up.
When the Curiosity Nano board is programmed, the firmware reads the MUI and stores it in an array. Every time the push button (SW0) is pressed, the MUI is printed on the UART which can be observed on the MPLAB Data Visualizer. The LED state toggles every time the push button is pressed for visual confirmation.
This project demonstrates how to read the MUI from the device's memory and display it using the UART module and the MPLAB Data Visualizer. The MUI is helpful with uniquely identifying the device in a given application.