Sonntag, 5. Dezember 2010

HOWTO compile arduino programms without its slow IDE...

As i wrote in my first post i am currently trying to get rid of the Arduino IDE. Don't get me wrong, it's a great IDE for small & quick projects. No hassle with header files and so on. Just type your few lines of code and you're ready to go. But eventually the day where you need more editing power will come. From my experience Arduino IDE is fine as long as your lines of code are not more than 1, say 2 pages and you don't have extern files. It's possible thou to add new tabs (= new files) in Arduino IDE but there are some important options missing: you can't collapse text levels, e.g. 'close' functions you actually don't need to save view space and the code highlighting lacks some functionality too. Plus its slow, big in memory and full of odd bugs. Try to close a tab in a just created sketch and you'll see what i mean.

So i started editing my code files in an extern editor while still using ArduinoIDE to compile and upload. That didn't work so good either, mainly because the process takes so long. All arduino core files are compiled into a file named core.a every time you compile something. Why is that? So i decided to use my own compile & upload feature via the command line..

Sonntag, 28. November 2010

protothread and arduino, a first easy example

I wrote a little example to demonstrate the possibilities of protothread and an avr µc. I decided to use some arduino specific functions like pinMode(), digitalWrite() and digitalRead() because i think this way it is very easy to understand what's happening in the code. But you should always keep in mind that these functions are up to 50 times slower than direct port access. It's easy to change the read and write functions to direct port access later on in a project if more I/O power is needed. For me arduino is a rapid prototyping platform...

Samstag, 27. November 2010

protothread, a powerfull library

Some weeks ago, while browsing around the net i found Adam Dunkels website.
Back in 2005 he wrote protothread as an easy way to implement blocking conditions.
"Protothreads are a extremely lightweight, stackless threads that provides a blocking context on top of an event-driven system, without the overhead of per-thread stacks. The purpose of protothreads is to implement sequential flow of control without using complex state machines or full multi-threading. Protothreads provides conditional blocking inside a C function." []
Basically protothread is the implementation of stack less coroutines. Of course no real coroutines because the basic µc has only one core and no scheduler. What it does, is that it gives you the possibility to manage your code in a very easy way using 'thread a like functionality'. It consists of a few include files defining macro's that are used to implement threads as switch/case constructs.
The trick was originally invented by Tom Duff and dubbed Duff's device.

Mittwoch, 24. November 2010

harte ware

Hey all, welcome to my blog!
Harteware is german and is the direct translation of 'hardware'. This term is never used anyhow.
Two years ago i started to code in c/c++ on the avr platform with the arduino environment. Before that i did a lot of electronic soldering, so i started mixing both worlds: the hard- and the software.
Love it or hate it, but arduino has brought a lot of new people to this whole hardware thing and myself to the µc world.

At the moment i have a few projects going on which i am going to summarize and file here. Also i am in the process of migrating away from the arduino IDE while still use some of the provided comfort. I am using kate as an editor and the arduino IDE to compile the code. To do so, just check the box on the 'use external editor' box in the preferences menu. In parallel i am trying eclipse with the avr plugin as IDE, but i am still having trouble with the resulting codesize, so until i fix that i'll just use kate.

If you have something to add, your critic and/or tipps are always welcomed!