digital inputs interfacing with avr primer

Posted on Feb 5, 2014

A switch is an electrical component that can break an electrical circuit, interrupting the current or diverting it from one conductor to another. A switch may be directly manipulated by a human as a control signal to a system, or to control power flow in a circuit. Fig. 1 shows how to interface the switch to microcontroller. A simple switch has an open state and closed state.

digital inputs interfacing with avr primer
Click here to download the full size of the above Circuit.

However, a microcontroller needs to see a definite high or low voltage level at a digital input. A switch requires a pull-up or pull-down resistor to produce a definite high or low voltage when it is open or closed. A resistor placed between a digital input and the supply voltage is called a "pull-up" resistor because it normally pulls the pin`s voltage up to the supply. We now want to control the LED by using switches (Digital-Inputs) in AVR Primer Board. It works by turning ON a LED & then turning it OFF when switch is going to LOW or HIGH respectively. The AVR Primer board has eight numbers of point LEDs, connected with I/O Port lines (PORTB. 0 PORTB. 7) to make port pins high. Eight switches, connected with I/O port lines PORTB are used to control eight LEDs. To compile the above C code you need the CodeVision AVR software. The software has it`s own IDE and built-in AVR gcc- Compiler. They must be properly installed and a project with correct settings must be created in order to compile the code. To compile the above code, the C file must be added to the project. In CodeVision AVR software, you can develop or debug the project without any hardware setup. You must compile the code for generating HEX file. In debugging Mode, you want to check the port output without microcontroller Board. If you are not reading any output signal in LED, then you just check the jumper connections. Otherwise you just check the code with...

Leave Comment

characters left:

Related Circuits

  • New Circuits



    Popular Circuits

    8052 Microcontroller Projects
    Crank Doorbell Circuit Schematic
    Frequency to Voltage Converter Circuit Schematic Diagram
    Converter Circuit 6
    Toyota MR2 Power Steering System
    Clarinet Vacuum Tube Linestage
    Simple Infrared Control Extender
    ds1820 interfacing with avr slicker
    Circuit explanation of DC/AC inverter
    13.8V 20A linear power supply
    edm production circuit