Arduino Uno boards contain ATmega328p chips. Add a few extra files from MiniCore and you can program boards with ATmega 8 MCUs.
ATmega168, ATmega88, ATmega48 and ATmega8 chips are the same processor with different flash and ram sizes.
Open your Arduino IDE and find the custom character example file. These examples are part of the LiquidCrystal library. We will use the pin numbers in the sketch as they are.
Set the boards manager to Arduino Uno and compile with the verify check mark command. We see the compiled program uses only 7% of the flash in the ATmega328p chip and a tiny amount of the 2kB RAM.
The pin numbers used for connections can be changed. You may own an LCD shield wired differently. But these are used in all the LiquidCrystal library examples and in the simulator used in this project.
Add MiniCore URLOpen preference menu File -> Preferences
Go to Additional Boards Manager URLs: and add
https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json
Click on OK to save this entry. You may want to increase font size.
Go to Tools Boards: Boards Manager notice the available boards. It will take a moment to update.
Search for minicore and install. Installation will be quick for such a small add-on. Arduino already has the software we need. We are just adding some new board definitions.
Look at Boards and see the new additions
Select ATmega8 and compile the sketch, again. Look at the output of our Arduino screen and we see different numbers, the same program takes up more space in a smaller device. At the very bottom we see parameters for the ATmega8.
Go back to the Tools menu. When we selected ATmega8 a bunch of new options appeared. My devboard has an 8MHz crystal oscillator so I correct. Compiling with the wrong clock frequency means program timing will be off.
This is the same hex file that Arduino uploads to a board. We can use this in a couple ways.
The binary will be in the same folder as the sketch. It is CustomCharacter.ino_atmega8_16000000L.hex.
This will run in a hardware board containing an ATmega8 or in simulator software.
SimulIDEOpen SimulIDE circuit simulator. Use File Explorer to find and open Examples/Micro/Avr/mega8/mega8_AlarmClock/ AlarmClock.sim1 pull the simulator circuit onto the blank screen or double click.
Right click directly on the ATmega8 chip and look for the Load firmware command.
Navigate to the CustomCharacter arduino sketch. Locate the hex file we generated. The file name is CustomCharacter.ino_atmega8_16000000L.hex. Click ok or enter to Load firmware.
Click the ON/OFF commandAs a safety feature SimulIDE shuts down when you change hardware or software.
The connections in the simulation match the pins used in the LiquidCrystal library examples. You can repeat this project with each of the examples and they will run.
There's moreMiniCore adds AVR C code examples for the ATmega8. They don't use the LCD display and you may need to change the circuit.
Go to ATmega 8 DevBoard programming to see firmware upload using a USBtiny programming device.
And we can upload our Custom Character sketch to the Atmega8 devboard.
Comments