Skip to main content

Posts

Showing posts from March, 2019

Interface Push Button To Atmega328 with Input Pullup

     In previous tutorial we learned how to interface a LED to Atmega328 and then wrote the code in Atmel Studio to make it go 'ON' and 'OFF' after every one second. In short we learned how to use our MCU's port pin as a simple digital output. In this tutorial we will be using a push button as an input to turn LED on for certain duration.      Like last tutorial we will be using PORTB for our purpose. We will be using PB5(Pin 19) as output and PB1(Pin 15) as input. In this tutorial we will be using Current Sink method to interface LED with the mcu, whereas internal pullup method for interfacing the pushbutton. The following image shows the circuit we need to assemble. Schematic for Interfacing LED and Button What is Current Sinking?      When the current flows from power supply to load and then to the Microcontroller's pin (or any other device) the configuration is called Current Sinking. In our circuit Power Supply is of 5V, LED is the Load and the

Creating The First Project in AS7 and Blinking a LED

     Assuming that you have followed the previous tutorials and set up environment for AVR development using Atmel Studio, let us now see how to create a new project in Atmel Studio 7 (AS7). Please take note that while Installing Atmel Studio it will ask permission for installing packages for 8/32bit AVR micro-controllers as well as ARM series, make sure you select the packages for 8/32bit avr micro-controllers.  Step 1      After starting the AS7, you will see the welcome screen in which you can see lots of tools in toolbar and 'Start Page' in tab section. Under that tab look for 'Start' under which lie the 3 options New Project, Open Project and New Example Project. Click on 'New Project' or you can go in file menu and select project under new sub-menu. Atmel Studio 7 home screen  Step 2      Once you choose to create a new project in Atmel Studio, a dialog box will pop up to ask what programming language you want to choose. Select 'GCC C E