Attiny84 does not enter interrupt

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, my purpose is to use external interrupt pin. I hooked up button to PB2 in Attiny84, although ı press button led doesn't

turn on where is the mistake?

 


#define F_CPU 1000000UL
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <stdio.h>

ISR(INT0_vect);
void interupt_init();

ISR(INT0_vect){

	PORTA|=(1<<7);
}

void interupt_init(){

	MCUCR=(1<<ISC01)|(1<<ISC00); // rising edge
	GIMSK=(1<<INT0);
	sei();
}

int main(void){

	DDRA=0X80;

	interupt_init();

        while(1);		

	return 0;
}

 

This topic has a solution.
Last Edited: Tue. Apr 26, 2016 - 08:58 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What warnings or errors do you get when doing a clean build?

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Pull-up?

 

Show how you've wired up your button.  And your LED.  Are you sure it isn't backwards?

 

A schematic is best.
 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Build: 1 succeeded or up-to-date, 0 failed, 0 skipped,   

 

Last Edited: Mon. Apr 25, 2016 - 07:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tell how you expect to get a rising edge out of that schematic.  (with pullup enabled or not...)  I guess it is possible if the --|> symbol represents Vcc.  It looks like chassis ground to me.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Mon. Apr 25, 2016 - 07:49 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

berkay91 wrote:
Build: 1 succeeded or up-to-date, 0 failed, 0 skipped,
Greg_Muth wrote:
What warnings or errors do you get when doing a clean build?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 --|> this symbol represents +5v in proteus, when ı click clean solution it gave Build succeeded.
========== Clean: 1 succeeded, 0 failed, 0 skipped ==========

Last Edited: Mon. Apr 25, 2016 - 08:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

berkay91 wrote:
when ı click clean solution it gave Build succeeded
theusch wrote:
Greg_Muth wrote: What warnings or errors do you get when doing a clean build?

 

Proteus?  So we aren't concerned with a real app here?  What voltage is on PB2 when the button is pressed?  What voltage is on PB2 when the button is released?  Without Vcc or Gnd connections to your micro, will it run at all?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simulate the code and see where it goes wrong.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you try LED of another color? Blue LED-s have high voltage drop. Maybe your code works correctly, but the LED current is so low so you can't see its light.

What is Vcc value? Maybe it's too low for blue LED?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ı tried to turn on led with another code in this circuit and ı could turn it on, there is no problem proteus schematic, voltage setting etc..

Last Edited: Tue. Apr 26, 2016 - 08:39 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ı solved problem, my compiler is Atmel Studio 6.0 ı've selected Attiny84A, ı changed it's name by being Attiny84 and problem vanished...