Category Archives: AVR

Introduction to pwm [part 7]

Goodnight, seems like I still took a long time to finish this tutorial, but now I’m officially in vacations so I think I have more spare time to write the tutorials faster.

Lets start, this one will be about PWM generation using the hardware timers.
PWM stands for Pulse Width Modulation, what all this fancy words mean is that using a timer (or by software but that is not aborded in this tutorial) we control the time that our signal is HIGH and LOW, by doing this the average energy that is supplied to our target device can be controlled and this HIGH and LOW time is called duty cycle. Continue reading

Introduction to timers [tutorial part 6]

Goodnight fellow reader, today I will talk a bit about timers, they are super useful and usually they give a lot of headaches to the newbies and the not so newbie user. Timers are used to count time, and can be used to generate precise delays, make a stable “heart-beat” to our application or can be used to generate pwm signals, all handy stuff that we can use.
Continue reading

Using the ADC [tutorial part 5]

Hello dear readers, today I will write(a lot, this is a pretty long tutorial today) about the internal ADC of our micro-controller, but first a little introduction to what is an ADC.
ADC stands for analogic to digital converter and permits us to convert analogic voltage levels to a digital representation, this permits us to read things like the output of a potentiometer, LDR’s, temperature sensors(like the LM35), humidity sensors, accelerometers and gyroscopes that have an analogic voltage output, pressure sensors and much more things.
Continue reading

Bitwise maths and logic operators [tutorial part 4]

Hello, here I’m again, today I will give a small maths lesson, don’t run away, its easy and its very useful for embedded programming, and its also nice to know a bit more about how our little micro-controller works. In fact I will write about bitwise operator and their usage to set, clear, toggle and even multiply and divide(!), its also the fastest way to configure registers, and to handle digital input and output operations, this bitwise maths is done using basic logic operator, like AND, OR, NOT and other.
Continue reading

Direct port manipulation, using the digital ports [tutorial part 3]

Hello fellow readers, today I will write a bit about the digital pins and how to read and write digital values to then, its a simple subject but of a great importance, because almost everything that our micro-controller does is using its inputs and outputs to talk with leds, motor drivers, lcd’s, shift-register, to read data from digital sensors and a lot other things, so lets start reading about how to do it. Continue reading

Using the USART/serial [tutorial part 2]

Hello again, today I will continue with my tutorial series and I write a bit about the USART(or UART in other avr models), the USART give us the possibility to have a serial port, and that is a pretty nice thing to have, because it can be used for example to upload programs to our Arduino(via bootloader), to have a communication channel between our micro-controller and our computer, or to talk to some sensors/chips, the most used ones are serial backpacks for lcd’s and graphical lcd’s and GPS modules that use almost always an serial interface. Continue reading

How to start using AvrStudio, C code and Arduino

Hello to everybody, here you will encounter a simple introduction on how to make the jump from the arduino IDE to plain simple C code with no extra grease(from all those libs made by god know who). Continue reading