Getting Started
A short overview for beginners with microcontrollers and/or the programming language Luna.
Basics
Equipment
- ISP (In-System-Programmer) AND
- Evaluation board for Atmel microcontrollers OR
- combined Board & ISP, e.g.: "Starter kit Luna" provided by eHaJo
See also: Artikel ISP/Boards (mikrocontroller.net)
Tutorial
Getting started with Luna
Installation
- Download the archive with the actual LunaAVR development environment.
- Just unpack the archive and save the folder with all files on a place of your choice. The LunaAVR development environment can also be started from USB-stick. There is no need for an installation with changes on your system; therefore an installation-program is not necessary. With unpacking and copying the files to the place of your choice the installation is done. If desired, a shortcut on your desktop can be created easily (e.g. for Windows OS: Select the LunaAVR symbol and drop it on your Windows Desktop while holding the „ALT“ key.
First Start & Setting
After starting the program „LunaAVR“ adjust the setting for ide-programmer-uploader.
Other settings are at the moment not required, we are now ready to start programming.
Examples
A Luna program requires a minimum of three definitions:
- What microcontroller should be used („device“)
- What clock rate is given by fusebit and hardware (e.g. quartz) („clock“)
- Stack size („stack“) - What does stack mean?
Learn more: Root class Avr
Example for an empty correct program:
avr.device = atmega168 avr.clock = 8000000 avr.stack = 32 halt()
Another simple program, an LED connected to PortB.0 (Pin 14) is flashing:
Learn more: #Define, Port-pins of the microcontroller und Wait, Waitms, Waitus
avr.device = atmega168 avr.clock = 8000000 avr.stack = 32 #define LED1 as portB.0 'LED1 is defined as label for portB.0 LED1.mode = output,low 'the port is configured as output and set to low do LED1 = 1 'switch LED1 on waitms 500 'wait for 500ms LED1 = 0 'switch LED1 off waitms 500 'wait for 500ms 'alternatively for the commands above also following commands can be used 'LED1.toggle 'toggle the actual status of the port pin 'wait 1 'wait for 1 second loop