Go Down

Topic: Confusion about none working Interrupt 2 on a ATMega644P/1284P (Read 6271 times) previous topic - next topic

1studio1

Well that's what I was expecting with INT2 then I read a couple of reports on-line that said otherwise. which to be honest I thought was rather daft, why would a MCU man. bother doing that. Certainly I found nothing in the data sheet to allow me to confirm this and surely that should be the only source of accurate data.

Proper Port addressing seems to be the best and most robust way of doing this task. and with the knowledge gained from this exercise and help given here that is certainly the only way I will be handling them in future.

JChristensen


I'll certainly have a go with your code once I get Studio working lol - Atmel support sent me a patch today but that won't even install so the issue is on giong. I want to get more into this type of programming as I can see some advantages - like it doesn't limit you to using Arduino IDE  (which is still a great tool.


What kind of limitations are you running up against with the IDE? I wrote that code in the Arduino IDE, and it runs just fine there. Both use the GCC compiler, so moving source code between the two rarely requires anything more than copy and paste.

1studio1

Sorry Jack,

My mistake - I thought is was not an IDE sketch. Yes just tried it and it works flawlessly Thanks - I am going to have a play with tonight as it looks interesting (or am I just a bit of a sado :) )

TY Steve

Nishant_Sood

Hi Steve,

By core I meant the Arduino "core" code ... I'm using maniacbug's mighty-1284p core.

Anyway the following sketch works fine for INT0, 1 or 2. I'm just using a 1Hz square wave from an RTC as the signal to the interrupt pin, and toggling an LED.

Code: [Select]
const uint8_t ledPin = 7;

void setup(void)
{
    pinMode(ledPin, OUTPUT);
    attachInterrupt(2, intHandler, FALLING);
}

void intHandler(void)
{
    static bool ledState;
    
    digitalWrite(ledPin, ledState = !ledState);
}

void loop(void)
{
}

Hi Jack ,im using  maniacbug's mighty-1284p core but none of my interrupts work if I use the attachInterrupt method however, configuring the interrupts directly from the registers and get rid of Winterrupts.c works them!(however creating unexpected uC behaviour!) , how to make interrupts work normlly?

EDIT
im compiling it as 'Original Mighty 1284p 8MHz' bcz I have a INTROSC based system!
"Real Men can Accomplish  Anything"

- skype : nishants5  
ਫ਼ਤੇਹ ਕਰੁਂ!
www.winacro.com

Go Up