Embedded Programming


The first thing we have to do to program electronic circuits, is to understand the way they work, and fundamentally, knowing in depth the microcontrolles: their properties, functions and possibilities. So is a good idea to get some information about the microncontroller we use in our Fab ciurcuits, the Atmel ATtiny 44A.


These are small microcontrollers from the Atmel AVR family home. They are very popular due to the facility with which they can be programmed, as they have a fairly simple design. Our ATtiny have a 4kB programmable flash memory, and have 12 pins. And is really important to understand what does each pin of the processor and how do they work.






To program a microncontroller for an electronic circuit, we need this elements: an ISP programmer (we make it in the fifth week of the Fab Academy), an electronic circuit with our ATiny44A microprocessor, and a miniUSB and USB-FTDI cables to connect the boards with computer (PC-ISP-FTDI board).

Then we just have to write the code to program de microntroller. There are a lot of possibilities. Fab Lab recomend us to write in C or C++. We can also try to program in Phyton and why not, in the Arduino IDE if this is your first contact with the programming code.



The Arduino IDE (Integrated Development Environment), based on Processing language, permit us to write sketches in a simple way. In fact, the microcontroller receives C code... but I did not write my code in this language! Internally, Arduino IDE translates the code, and use avr-gcc compiler, for the microcontroller understand what you have programmed.




I started loading some Arduino IDE examples. Then I went modifying and testing by changing commands and values (example), to get familiar with the codes.



My second option was try to use C code, using the Atmel Studio (if you have Windows 8 OS this is almost the unique way to programm using C). We can download the software as a guess user. You have to install Microsoft Visual Studio; wizard installer does it automatically. The C code is really hard if you are a beginner programmer. I studied some of the examples of the software. And we will definitely need more than a week to learn and practice with this code. If you're a Windows user, you also can try WinAVR.



Another option was to learn Python, so I started a course in Code Academy. Although it is for beginners, you need some basic technical knowledge.

One thing to keep in mind when you are learning multiple programming languages, is that although the syntax of some languages are similar, each has its own. So you need to know in which languages you consider spaces, capitalization, etc.



A practical idea to practice programming without getting bored programming, can be, in case you have an Arduino board and a starter kit, to slowly go about doing projects. Thus as we move towards more complex projects, we learn more about the programming language. Motivate since not only you have to write code like exercise, but also see results!


Definitely a fundamental class. As a key is to select a not very complex language to start, and gradually go stepping forward. And above all practicing, a lot.