![]() 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 ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |