/**************************************************************************
Timer1 004 Normal mode with 3 ISR
empty loop
This program was written in the simplest possible way in order to prevent
a not excellent knowledge of programming language. It is possible use it
HOW IT IS only on the wokwi simulator
For no reason the use of this code make the authors responsible and
even less obliges them to provide support and / or any explanation or
clarification
However, if possible, we will try to answer to any questions,
without any obligation and / or commitment and / or responsibility
by https://www.facebook.com/groups/883620498953478 TEAM
The user of this software will have total, complete
and exclusive responsibility for anythings.
Anyone can modify it and adapt it to own needs,always reporting the
present declaration, even after important changes.
These phrases will always reported in complete form, without this declaration
there will be a copyright violation
Thank you
**************************************************************************/
#define led1 13
#define led2 12
#define led3 11
void setup() {
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
pinMode(led3,OUTPUT);
// SEGNALE START
PORTB|=B11111000; delay(600);
PORTB&=B11000111; delay(600);
PORTB|=B00100000;
cli(); // Nointerrupt - tutti gli interrupt disabilitati
// RESET TIMER1
TCCR1A = 0;
TCCR1B = 0;
// Set soglie A e B
OCR1A = 44000;
OCR1B = 22000;
// abilita i 3 Timer1 interrupt
TIMSK1 |= (1 << OCIE1B);
TIMSK1 |= (1 << OCIE1A);
TIMSK1 |= (1 << TOIE1);
sei(); // abilita tutti gli interrupt
// set prescaler & start counter
TCCR1B |= (1 << CS12);
}
ISR(TIMER1_COMPB_vect) {
PORTB&=B11110111;
PORTB|=B00010000;
//digitalWrite(led1,HIGH);
//digitalWrite(led2,HIGH);
//digitalWrite(led3,LOW);
}
ISR(TIMER1_COMPA_vect) {
PORTB&=B11001111;
PORTB|=B00001000;
//digitalWrite(led1,LOW);
//digitalWrite(led2,LOW);
//digitalWrite(led3,HIGH);
}
ISR(TIMER1_OVF_vect) {
PORTB&=B11100111;
PORTB|=B00100000;
//digitalWrite(led1,HIGH);
//digitalWrite(led2,LOW);
//digitalWrite(led3,LOW);
}
void loop() {
// loop vuoto
}