diff --git a/Microcontrollers/Opdracht 2.2/main.c b/Microcontrollers/Opdracht 2.2/main.c index 56f878f..b8166c7 100644 --- a/Microcontrollers/Opdracht 2.2/main.c +++ b/Microcontrollers/Opdracht 2.2/main.c @@ -14,7 +14,10 @@ void wait( int ms ) { _delay_ms( 1 ); // library function (max 30 ms at 8MHz) } } - +/************************************************************************/ +/* interrupt 1 +walk the light 1 down */ +/************************************************************************/ ISR( INT1_vect ) { if (PORTC == 0b10000000) { @@ -26,6 +29,10 @@ ISR( INT1_vect ) { } +/************************************************************************/ +/* interrupt 2 +walk the light 1 up */ +/************************************************************************/ ISR( INT2_vect ) { if (PORTC == 0b00000001) { @@ -47,13 +54,13 @@ int main(void) EICRA |= 0x2C; // INT2 falling edge, INT1 rising edge EIMSK |= 0x06; // Enable INT2 & INT1 - PORTC = 0x01; + PORTC = 0x01; // init the first bit - sei(); + sei(); // enable input mechanism while (1) { - wait(500); + } } diff --git a/Microcontrollers/opdracht 2.3/main.c b/Microcontrollers/opdracht 2.3/main.c new file mode 100644 index 0000000..5bfbf00 --- /dev/null +++ b/Microcontrollers/opdracht 2.3/main.c @@ -0,0 +1,38 @@ +/* + * main.c + * + * Created: 2/10/2021 11:45:42 AM + * Author: Sem + */ + +#include +#include +#include + +void wait( int ms ) { + for (int i=0; i + + + + + + Device + Startup + + + Atmel + 1.6.0 + C:/Program Files (x86)\Atmel\Studio\7.0\Packs + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\xc8\avr\include\avr\iom128.h + + header + XC + JdJ7J9I/SJh965SEyyyVYw== + + xc8/avr/include/avr/iom128.h + + + + + ATmega_DFP + C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.6.364/Atmel.ATmega_DFP.pdsc + 1.6.364 + true + ATmega128 + + + + Resolved + Fixed + true + + + \ No newline at end of file diff --git a/Microcontrollers/opdracht 2.3/opdracht 2.3.cproj b/Microcontrollers/opdracht 2.3/opdracht 2.3.cproj new file mode 100644 index 0000000..fb30d94 --- /dev/null +++ b/Microcontrollers/opdracht 2.3/opdracht 2.3.cproj @@ -0,0 +1,31 @@ + + + + 2.0 + 7.0 + com.microchip.xc8 + 2285C48D-296E-43FD-A7B6-69885F64CFFD + ATmega128 + none + Executable + C + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + opdracht 2.3 + opdracht 2.3 + opdracht 2.3 + + + + + + + + + + compile + + + + \ No newline at end of file