This repository represents an MPLAB X project for an application that shows the current time using an OLED screen. The clock is configurable by the Curiosity Nano's on-board button.
More details and code examples on the AVR128DA48 can be found at the following links:
- AVR128DA48 Product Page
- AVR128DA48 Code Examples on GitHub
- [AVR128DA48 Project Examples in START] (https://start.atmel.com/#examples/AVR128DA48CuriosityNano)
- MPLAB® X IDE 5.40 or newer (microchip.com/mplab/mplab-x-ide)
- MPLAB® XC8 2.20 or newer (microchip.com/mplab/compilers)
- MPLAB® Code Configurator (MCC) 3.95.0 or newer (microchip.com/mplab/mplab-code-configurator)
- AVR-Dx_DFP 1.1.40 or newer Device Pack
- 8-bit AVR MCUs Lib version 2.3.0
- AVR128DA48 Curiosity Nano (DM164151)
- Curiosity Nano Base for Click Boards (AC164162)
- OLED C Click – Mikroe (MIKROE-1585)
The OLED C Click is connected to the first slot on the Base board.
The AVR128DA48 Curiosity Nano Development Board is used as test platform.
The following MCC configurations must be made for this project:
- System Module
- Internal Oscillator (24 MHz)
- Prescaler disabled
- WDT disabled
-
Interrupt manager
- Enable Global interrupts
-
RTC
- Internal 1.024 kHz oscillator
- 1 second period
- Overflow interrupt enabled
- OLED C
- Do not generate example
- SPI
- Generated by OLED C
- MISO as PA5, MOSI as PA4 and SCK as PA6.
- Pin Manager
- PA7 as output named "oledC_nCS"
- PC7 as input with Pull up enabled named "Button"
- PD0 as output named "oledC_DC"
- PD3 as output named "oledC_RW"
- PD6 as output named "oledC_EN"
- PD7 as output named "oledC_RST"
The source code for this project can be downloaded from the current page by clicking the "Download" button, or if you want to make your own project, please pay attention to the following steps:
- After making the MCC settings, press the "Generate" button, and this will generate the required .c and .h files.
- Several files have to be added to the project and some of the generated files (oledC.c and pin_manager.c) have to be modified. It is strongly encouraged to use the whole project downloaded from here.
The flow diagram is presented in the picture below:
- Connect the AVR128DA48 Curiosity Nano Development Board to PC using the USB cable.
- Build the firmware and load the generated hex file into MCU.
After the code has been compiled and loaded onto the device, the OLED should light up and start counting. The digits can be changed by pressing the button. A long press changes the selection.
This example represents a real time clock displayed on an OLED screen.