I have to admit that I do have previous C/C++ experience. My final computer vision project that I presented to the EUCYS was written in C++ giving me previous knowledge. I had the intention of exploring a field I had no experience in, such as PSoc programming, however that did not workout to the degree I desired.
Niels worked through the 8th week shedule page as ususal dissussing the various options we had. Making it very clear that there is, in fact, no difference between programming in the Arduino IDE and conventional C programming.... Except it's far easier for beginners.
The assignments for the first week were:
I. Read a microcontroller Datasheet.
I. Program your board to do something
Highlighted necessary tools:
>> Your brain
One question I have had through-out this entire week was, why do we even use C... I mean Phyton, Java, and the 1 million more new languages have such a simple and friendly syntax.... While the majority of people, it seems, STILL like to program microcontrollers using C, but coming from me it's a little hypocritical since I really like C.
I wanted to learn something new, so originally I wanted to Program a PSoc board, however I figured ordering it was going to be too much of complication.
Since I had used the IDE Processing in the past, I was quite happy working around the very similar and familar Arduino IDE; I was going to use a different IDE to try something new. I picked Eclipse IDE which I have bearely used in the past (I have programmed Java in it, to try out some simple Genetic Algorithms).
This meant I was going to program in pure C/C++.
Online Video Tutorials & Links:
While I do have knowlesdge with Programming, I had no experience with using Eclipse, or using Eclipse to program AVR's, or programming AVR's at all.... Well Emma tought us to use the Arduino IDE on Thursday but that didn't give me any insight on using Eclipse, however it was still a really good lesson.
So I went to Google and searched for infomration, from this research the following links are the most valuable.
=> How to program the AVR microcontroller Pt 2
=> AVR_Programming Video2-Programmers Notepad & Make file creation
=> Getting Started AVR with Eclipse Development and Arduino board in Linux
=> AVR ATtiny85 Programming: Blink LED (Digital Output)
Admittingly have used the AVRdude terminal commands without having a clue of the command I was typing, mostly using "avrdude -c usbtiny -p t44" to check if an ATtiny was connected... So I felt it was about time I understood how it worked, which wasn't difficult.
Typing "avrdude" in the terminal will open up all the Avrdude options (see Google Doc Slide 9#).
This alowed me to have an insight on the options I used.
-c = Specify programmer type.
-p = Required. Specify AVR device.
-u = Disable safemode, default when running from a script.
-U = Memory operation specification.
Using "avrdude -c asdf " shows all acceptable programmer types, for us we will need usbtiny
Eclipse was created to program in Java, therefore, as expected, right out of the box Eclipse doesn't do much of what I needed it to.
The first thing I did was install the C/C++ envioronment needed to write programs in C, this is a simple option in the Eclipse Installer which pops up every time you open the Eclipse IDE (See Image 1#)
Having done this, it is necessary to add the AVR Eclipse Plugin which allows us to set up AVR projects.
Doing this requires several steps, the first is downloading CrossPack (for Mac) which is an AVR-GCC toolchain which adds usefull libraries and other stuff we need to program our AVR chip (see Google Doc Slide 1#).
After doing this it was necessary to install the AVR plugin, this was done following the insturctions on the official AVR plugin page (See Image 2# & Google Doc Slide 2# & 3#).
This concluded the setting up of Eclipse.
Programming & Reading The Datasheet
Next was the programming which was rather straight forward. Creating a new C project in eclipse and selecting the right preferences (See Image 3# & Google Doc Slide 4#) was the first step, then adding a new source fail "main.c" where we will wirte the program (See Google Doc Slide 5#)
The key was checking out the datasheet to select the exact frequencies (see Image 4# & 5#) and the write commands, which are clearly specified in the datasheet. The major problem is finding what you need in the ocean of information it has, but after some getting used to it gets pretty easy to understand where is what.
I then proceed to make different test programs which where still quite unadanvced due to the fact they written by myself , following the huge datasheet.
The example program seen in Image 6# create a dim light. While the one I have installed now is a 100ms blinking light. On Google Doc Slide 6# you can see the first program I wrote to check it was working.
I used a comment drawing, as see at the top of Image 6#, that helps me see on which pin every component is, following the pin out configuration.
Eclipse Bulding & Flashing The ATtiny44
After changeing the Build Configuration to "Realease" bulding the .hex file was as difficult as clicking a button, the hammer button on the top (Success is seen in the Eclipse console ,see Google Doc Slide 7#).
After this I opened up the terminal, using "cd" I specified where the .hex was. I then connected the ISP with the Echo-board attached and run the command "avrdude -c usbtiny -p t44 -u -U flash:w:FabAcademy_Programming_1.hex": 'FabAcademy_Programming_1.hex' being the name of the build .hex file.
Happily enough flashing worked (see Image 5#),and the Echo-board LED started blinking .
[Update 7 Jul 2016]
Eclipse can be set up to flash an ATtiny through the USBtiny without having to use the console thanks to the Eclipse AVR plugin; if you follow the linked video "Getting started with AVR with Eclipse Development..".