Regardless of the mcu I select no interrupt or timer works. But the code works just fine on the physical circuit. Is this a bug or some setting I need to do of sort?
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
ISR(INT0_vect){
PORTB = 0xff;
_delay_ms(10000);
}
int main(){
MCUCR |= (1 << ISC11 | 1 << ISC01);
GIMSK |= (1 << INT0 | 1 << INT1);
sei();
DDRD = 0x00;
PORTD = 0xff;
DDRB = 0xFF;
while (1)
{
/* code */
PORTB = 0xff;
_delay_ms(500);
PORTB = 0x00;
_delay_ms(500);
}
return 0;
}
Can you explain what that means?It more or less broke the 1.0.0 version
Did you wait 10 seconds (circuit time)?and in the 1.1.0 it detects the interrupt but won't return from it
#define F_CPU 8000000L
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
ISR( INT0_vect ){
PORTB = 0xf0;
_delay_ms(1000);
}
ISR( INT1_vect ){
PORTB = 0x0f;
_delay_ms(1000);
}
int main()
{
MCUCR |= (1 << ISC11 | 1 << ISC01);
GIMSK |= (1 << INT0 | 1 << INT1);
DDRD = 0x00;
PORTD = 0xff;
DDRB = 0xFF;
sei();
while (1)
{
PORTB = 0x00;
}
return 0;
}
Nice to know.It worked, my code works when I build it using microchip studio, I've been using platform io to build it , why is this the case?
TCCR1B = (1<<CS12|1<<CS10|1<<WGM12);
OCR1A = 7812;
TIMSK = (1<<OCIE1A);
ISR(TIMER1_COMPA_vect){
seconds=20;
if(seconds == 60){
seconds = 0;
minutes++;
}
if(minutes == 60){
minutes = 0;
hours++;
}
if(hours == 24){
hours = 0;
minutes = 0;
seconds = 0;
}
}
Similar topics
Permissions in this forum:
You cannot reply to topics in this forum