Now the final step is to press the play button on the bottom left corner of proteus window. Hexa file uploading for push button use with atmega32 avr microcontroller
Go to the option of program file, selects your required HEX file and click “OK”. Proteus setting of push button use with atmega32 avr microcontrollerĪgain double click on Atmega32 a dialog box will appear. circuit diagram of push button use with atmega32 avr microcontrollerĪfter designing the circuit make necessary changes by double clicking on crystal and Atmega32 a dialog box will appear now set the frequency of crystal and Atmega32, which is 16MHz and set the fuse bits of Atmega32. Notice that the Vcc and ground pins of Atmega32 are connected by default so there is no need to connect them until or unless you are working in the real world.
We use Atmega32, crystal, capacitors, resistors, LED and push button from the built-in library of Proteus. Programme of push button use with atmega32 avr microcontroller PORTD = PORTD & ~( 1<<4) //PIN4 of port D will remain low PORTD = PORTD | ( 1<<4) //PIN4 of port D is high If(PINC & (1<<5) ) //if PIN5 of port C is high #define F_CPU 16000000UL //clock speed is 16MHzĭDRD = DDRD | ( 1<<4) //Make pin 4 of port D as a outputĭDRC = DDRC & ~(1<<5) // Make pin 5 of port C as a input When we press the push button LED will glow otherwise it will remain OFF. Push button is connected to the fifth pin of PORTC while LED is connected to the fourth pin of PORTD. PORT register is an output register which shows status of pin either it is high or low. DDR command shows that whether the direction of pin is termed as input or output.
In this code we use two registers Data direction register (DDR) and PORT register. CODE TO CONTROL THE BLINKING OF LED VIA PUSH BUTTON