From: Maximilian Date: Tue, 11 Feb 2014 16:57:50 +0000 (+0100) Subject: Correctly set timer1's ICP on atmega8, atmega16 and atmega32. X-Git-Tag: v1.2~38^2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=8e02e6fc02136472f4bad8415a6005438258daa5;p=sx%2Fsimavr.git Correctly set timer1's ICP on atmega8, atmega16 and atmega32. --- diff --git a/simavr/cores/sim_mega16.c b/simavr/cores/sim_mega16.c index bf2ecb1..2bd092d 100644 --- a/simavr/cores/sim_mega16.c +++ b/simavr/cores/sim_mega16.c @@ -27,6 +27,9 @@ #define SIM_MMCU "atmega16" #define SIM_CORENAME mcu_mega16 +#define ICP_PORT PORTD +#define ICP_PIN 6 + #define _AVR_IO_H_ #define __ASSEMBLER__ #include "avr/iom16.h" diff --git a/simavr/cores/sim_mega32.c b/simavr/cores/sim_mega32.c index 40b74b4..4c5bc05 100644 --- a/simavr/cores/sim_mega32.c +++ b/simavr/cores/sim_mega32.c @@ -27,6 +27,9 @@ #define SIM_MMCU "atmega32" #define SIM_CORENAME mcu_mega32 +#define ICP_PORT PORTD +#define ICP_PIN 6 + #define _AVR_IO_H_ #define __ASSEMBLER__ #include "avr/iom32.h" diff --git a/simavr/cores/sim_mega8.c b/simavr/cores/sim_mega8.c index 74acf98..01c177d 100644 --- a/simavr/cores/sim_mega8.c +++ b/simavr/cores/sim_mega8.c @@ -25,6 +25,9 @@ #define SIM_MMCU "atmega8" #define SIM_CORENAME mcu_mega8 +#define ICP_PORT PORTB +#define ICP_PIN 0 + #define _AVR_IO_H_ #define __ASSEMBLER__ #include "avr/iom8.h" diff --git a/simavr/cores/sim_megax.h b/simavr/cores/sim_megax.h index 1cfaa07..b125cfc 100644 --- a/simavr/cores/sim_megax.h +++ b/simavr/cores/sim_megax.h @@ -211,7 +211,7 @@ const struct mcu_t SIM_CORENAME = { .r_tcnth = TCNT1H, .ices = AVR_IO_REGBIT(TCCR1B, ICES1), - .icp = AVR_IO_REGBIT(PORTD, 4), + .icp = AVR_IO_REGBIT(ICP_PORT, ICP_PIN), .overflow = { .enable = AVR_IO_REGBIT(TIMSK, TOIE1),