toggle PA3
This commit is contained in:
		
							
								
								
									
										17
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								main.c
									
									
									
									
									
								
							| @ -1,13 +1,18 @@ | ||||
| #define F_CPU 5000000UL // 5 MHz | ||||
| #include <avr/io.h> | ||||
| #include <util/delay.h> | ||||
|  | ||||
| int main(void) { | ||||
| #define PA3_SET_MASK 0x08 | ||||
|  | ||||
| int main(void) | ||||
| { | ||||
|     VPORTA.DIR = 0x0; | ||||
|  | ||||
|     // Configure PA3 as output (Pin 7 on ATTINY202-SSN) | ||||
|     VPORTA.DIR |= 8; | ||||
|      | ||||
|     while (1) { | ||||
|         VPORTA.OUT ^= 8;  // toggle PA3 | ||||
|     VPORTA.DIR |= PA3_SET_MASK; | ||||
|  | ||||
|     while (1) | ||||
|     { | ||||
|         VPORTA.OUT ^= PA3_SET_MASK; // toggle PA3 | ||||
|         _delay_ms(500); | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user