Czemu dioda podłączona do portu PD7 mignie i zgaśnie zamiast palić się z intensywnością zależną od licznika?
Układ zbudowany na CNY17, detekcja zera podanego na int1.
Układ zbudowany na CNY17, detekcja zera podanego na int1.
Kod: C / C++
Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tam#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#define D7 7 //dioda podłączone do pinów portu D
unsigned int counter=60110;
int main(void)
{
DDRD = (1 << D7);
MCUCR |= (1 << ISC01) | (1 << ISC11);
GICR |= (1 << INT0) | (1 << INT1);
TCNT1 = counter;
TIMSK |= 1 << TOIE1;
sei();
while(1);
return 0;
}
ISR(INT0_vect)
{
counter=61111;
}
ISR(TIMER1_OVF_vect)
{
PORTD &= ~(1 << D7);
TCCR1B =0;
}
ISR(INT1_vect)
{
PORTD |= (1 << D7);
TCNT1 = counter;
TCCR1B |= (1 << CS10);
}
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <stdlib.h>
//#define D7 7 //dioda podłączone do pinów portu D
unsigned int counter=60110;
int main(void)
{
DDRD = (1 << D7);
MCUCR |= (1 << ISC01) | (1 << ISC11);
GICR |= (1 << INT0) | (1 << INT1);
TCNT1 = counter;
TIMSK |= 1 << TOIE1;
sei();
while(1);
return 0;
}
ISR(TIMER1_OVF_vect)
{
PORTD &= ~(1 << D7);
TCCR1B =0;
}
ISR(INT1_vect)
{
PORTD |= (1 << D7);
TCNT1 = counter;
TCCR1B |= (1 << CS10);
}
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#define D7 7 //dioda podłączone do pinów portu D
unsigned int counter=10110;
int main(void)
{
DDRD = (1 << D7);
PORTD=(1 << D7);
MCUCR |= (1 << ISC01) | (1 << ISC11);
GICR |= 1 << INT1;
TCNT1 = counter;
TIMSK |= 1 << TOIE1;
sei();
while(1);
return 0;
}
ISR(INT0_vect)
{
counter=61111;
}
ISR(TIMER1_OVF_vect)
{
PORTD &= ~(1 << D7);
//TCCR1B =0;
}
ISR(INT1_vect)
{
PORTD=(0 << D7);
//TCNT1 = counter;
// TCCR1B |= (1 << CS10);
}