Hello, I'm learning AVR and trying the Pin Change InterruptRequest 0 (PCINT0) interrupt of the Attiny85 and found that it doesn't work in SimulIDE but works fine in the real attiny85.
The version I am using is SimulIDE 1.0.0-SR0 at REV 1320
System: Ubuntu 22.04.2 LTS
PB0 changed state by PCINT1 interrupt raised by PB1, it didn't work in SimulIDE. but works in real attiny85
I don't know if this is a bug of SimulIDE or am I doing something wrong?
Thank you!
The version I am using is SimulIDE 1.0.0-SR0 at REV 1320
System: Ubuntu 22.04.2 LTS
PB0 changed state by PCINT1 interrupt raised by PB1, it didn't work in SimulIDE. but works in real attiny85
I don't know if this is a bug of SimulIDE or am I doing something wrong?
Thank you!
- Code:
#ifndef F_CPU
#define F_CPU 100000UL
#endif
#include<avr/io.h>
#include<avr/interrupt.h>
ISR (INT0_vect) // Interrupt service routine
{
PORTB ^= (1<<PB1); // Toggling the PB2 pin
}
ISR (PCINT0_vect) // Interrupt service routine
{
PORTB ^= (1<<PB0); // Toggling the PB2 pin
}
void external_interrupt()
{
GIMSK |= (1<<INT0); // enabling the INT0 (external interrupt)
MCUCR |= (1<<ISC01); // Configuring as falling edge
}
void pin_change_interrupt()
{
GIMSK|= (1<<PCIE);
PCMSK|= (1<<PCINT1);
MCUCR |= (1<<ISC00); // Configuring as falling edge
}
int main()
{
DDRB |= (1<<PB1)|(1<<PB0); // set PB1 and PB0 as output(LED)
DDRB &= ~(1 << PB2); //set PB2 as input
PORTB |= (1 << PB2); //activate pull-up resistor for PB2
external_interrupt();
pin_change_interrupt();
sei(); //enabling global interrupt
while(1)
{
}
}
- Attachments
- pcint.zip
- You don't have permission to download attachments.
- (6 Kb) Downloaded 3 times