Skip to main content

Posts

Showing posts from September, 2013

Introduction to Pure C Arduino Library - Timers & Delays

As long as blinking a led is a fairly simple task. Arduino Library is very handy and can really improve the speed of development of a new projects, making your idea real & tangible. Something similar in C would be useful. At this moment one may ask - why to create a new library, when there are already plenty of those available and ready to use ? Well, thinking like that, we may ask ourselves straight away why to even bother and play with an 8-bit machine when there is so powerful and cheap stuff available out there at the moment everywhere nearly ? The answers for both are short and straight forward: Because we can and it's fun Because we want to learn something Because we want to create some real, useful stuff Another reason to create a library is to have some basic tool set which will be absolutely essential in most of any further developments. First thing which will need in this tool set is a proper (by proper I mean - timer/interrupt based) delay function. I hav...

Libraries, what they really are

This post is more of an introduction to what I plan to cover further on in the future. Let's start with the basics, for those who are not very familiar with C compilation details. How to create a library, what kind of libraries can we create, what are the advantages/disadvantages ? First of all, there are two types of libraries, static (*.a files) and dynamic libraries (*.so files). The first ones are just a bunch of object files glued together to form a single file (object archive). The second ones are loaded during runtime by operating systems (like Linux (*.so files) /Windows (*.dll files)) whenever applications need them. Both have their pros & cons. The advantage of dynamic libraries, short summary: The library code is NOT included in every application using the library, the resulting executables are smaller The library is loaded to memory by operating system (dynamic library loader) once an application requests it, and removed when no longer needed. The libr...

Arduino in pure C

Arduino is a great, simple development platform and it's simple enough that even less advanced users can start and be creative straight out of the box. I have nothing against the C++ Arduino Libraries but relying only on those separates you a little bit from the machine itself. Arduino is simple enough to use it with Pure C. Doing so, you will not only learn a lot more, but will have an ultimate control over your software and will better understand what really is going on. I dedicate this blog to everyone who is starting with Arduino as well as to those of you who already have a lot of experience with it but were never really brave enough to abandon the Arduino Libraries and IDE itself. In order to start we need a couple of tools. toolchain & cross compiler: avr-gcc, avr-binutils C library: avr-libc Programmer: avrdude Some other useful stuff which can be installed: debugger: avr-gdb simulator: simavr/simulavr On most of the modern system those packages can be ins...