Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Attiny85 PCINTx not work in SimulIDE

2 posters

Go down  Message [Page 1 of 1]

1Attiny85 PCINTx not work in SimulIDE Empty Attiny85 PCINTx not work in SimulIDE Thu Aug 17, 2023 7:53 pm

Deephot



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


Attiny85 PCINTx not work in SimulIDE Screen10

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
Attiny85 PCINTx not work in SimulIDE Attachmentpcint.zip
You don't have permission to download attachments.
(6 Kb) Downloaded 3 times

2Attiny85 PCINTx not work in SimulIDE Empty Re: Attiny85 PCINTx not work in SimulIDE Fri Aug 18, 2023 12:59 am

arcachofo

arcachofo

Thanks for reporting.
I will have a look.

3Attiny85 PCINTx not work in SimulIDE Empty Re: Attiny85 PCINTx not work in SimulIDE Fri Aug 18, 2023 8:46 pm

arcachofo

arcachofo

Issue solved at 1.0.0 Rev 1390 and trunk Rev 1798.

You can solve it easily by changing PCINT bit names, editing these files:

File: data/AVR/tinyx5/tinyx5_int.xml line 5 to this:
Code:
       <interrupt name="PCINT"   enable="PCIE"   flag="PCIF"  priority="13" vector="0x002" clear="1"/>

And file data/AVR/tinyx5/tinyx5_perif.xml line 8 to this:
Code:
   <interrupt name="PCINT" mask="PCMSK"/>

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum