Embedded Programming
The microcontroller is the brain of the circuit board. It controls the power, ditributes the electricity and operates the output devices. The microcontoller can be programmed to do any functionality and depends on the device by using the code system. The microcontoller is also called "MCU" and it is small in size to be put on a single integrated circuit. These microcontrollers can controll many machines such as automobile engines, smartphones, heavey machinary and home devices.
I have previous expereince working with ATMEL MCU and PIC micorcontroller. I started this week assignment by reading the ATtiny 44 data sheet
The pinout of this microcontroller is presented in the next Figure. The port B, C and D are programmable with multipurpose.
You can choose different methods to program your board 1. C using Arduino IDE libraries. Program written using Arduino IDE libraries takes most of the space of microcontroller because it loads many libraries of arduino into the chip. But this is the easiest to use. For writing code install Arduino IDE. Arduino 1.8.5 is the open source Arduino software (IDE) which makes easy to write code and upload it to the board. It runs on Windows, Mac OS X and Linux. The enviroment is written in Java and based on Processing and other open source software. This software can be used with any Arduino board. 2. C using avr-gcc libraries. From the C-source code the avr GCC compiler (together with the Preprocessor directives and the linker) produces machine code for the AVR microcontroller. Usually this code loes in the Intel Hex format pronounced (“Hexfileâ€). Download avr GCC compiler and avr libc. This is available free for almost all platforms and operating systems. 3. Assembly Language. Assembly language is the alphanumeric representation of machine code. This language gives the maximum control. The space requirement for this is very less as there are no external libraries to load. The instructions used in writing programs in assembly language are not general but specific to the microcontroller. Each company provides a set of instructions for there microcontrollers.
Arduino as ISP The Arduino ISP is an In-System-Programmer that is used to program AVR microcontrollers. You can use the Arduino ISP to upload sketches directly on the AVR-based Arduino boards without the need of the bootloader. Otherwise you can use it to restore the bootloader.
Follow the following steps for arduino IDE settings. In Tools go to and pick. Board-> ATTiny Processor-> ATtiny 44 Programmer-> usbtinyisp Clock -> 20Mhz External Port-> ttyUSB0 programmer -> USBtinyISP After settings you should upload your code into the board.go to sketch -> Upload using programmer
Blink LED
My code is to turn LED on when the push button is pressed 3 times
C using avr-gcc libraries.
Next step is to program the board using AVR-C. For this my code is written in gedit. Before writing the program we need to know everything for coding, compiling, and flashing your programs into the bare silicon of the AVR chips that are placed on your tables. To do so, you are going to need some hardware (a flash programmer) and some software (a code editor, C compiler, and the program that will communicate with the hardware flash programmer).
Makefile Compiling the source code files can be tiring, especially when you have to include several source files and type the compiling command every time you need to compile. Makefiles are the solution to simplify this task. Makefiles are special format files that help build and manage the projects automatically. The make command allows you to manage large programs or groups of programs. As you begin to write large programs, you notice that re-compiling large programs takes longer time than re-compiling short programs. Moreover, you notice that you usually only work on a small section of the program ( such as a single function ), and much of the remaining program is unchanged. Makefile is a program building tool which runs on Linux. It aids in simplifying building program executables that may need various modules
Below you can find the code written in C.
To run this file i will be using make file. The procedure to run make file is first open terminal in the folder having your code file (blink.c) and makefile. Then run sudo make flash.