Programming ATMega32

Discussion in 'Embedded Systems and Microcontrollers' started by skj, Aug 16, 2013.

  1. skj

    Thread Starter Member

    May 20, 2010
    I am new to micro controllers I am using ATMega 32, I want to achieve the following Conditions,how to write the programme in WinAVR Programmers Notepad Using C/C++ .

    PinB0 as Input
    PinB1 as output
    PinB2 as Input

    1) if B0 is 1 and PinB2 is 1 then PinB1 should be 0
    2) If B0 is 0 and PinB2 is 1 then Pin B1 should be 0
    3) if B0 is 0 and PinB2 is 0 then Pin B1 should be 0
    4) if B0 is 1 and pinB2 is 0 then Pin B1 should be 1

    Noe: 1.Input at Pin B0 will appear for a short time when Push Button is pressed momentarily
    2. Input at Pin B2 will be continuous or short time depending upon the source for this signal.
  2. donpetru

    Senior Member

    Nov 14, 2008
    It is not good that you have chosen PB0 as input button. Choose PB2 because it has external interrupt.

    You should rethink the Atmega32 pin allocation. In your example, what you want to do PB2 could better implement software using one of the ADC pins of the microcontroller (eg PA0 ... PA7). Then choose the output pin.

    The program can be written on Attiny45 or Attiny13, you no need ATmega32.
    skj likes this.
  3. Shagas

    Active Member

    May 13, 2013
    If you are new to AVR microcontrollers then you should learn the basics first before tryingto programm something .

    Why are you using programmers notepad when you get free copy of atmel studio 6 ?
    What programmer are you using?

    Here are some links to start learning:

    Also , this forum is great for general electronics help etc , but if you want help specifically with AVR then I suggest :

    On AAC (this forum) you will mostly see people asking for help with PICs , not AVR.
    skj likes this.