external interrupt atmega

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
manuel_bayer
Posts: 10
Joined: Wed Oct 16, 2013 1:55 am

external interrupt atmega

Post by manuel_bayer »

hello,

i tried to activate the external interrupt int0 on atmega328.
its just a button connected to PinD2 (i tried other pins also) that stops the while-loop and calls a macro to turn on a led.
it does not work, nothing happens. Why?

i tried another way:

my aim is to react on a keypad input, i connected my keypad to the port b pins and used IOCB0 interrupt to call a macro, but it does not react, when i connect a simple button it reacts directly?
is it possible to set the interrupt on the Port B Pins with a keypad, because normally keypads work with multiplexing.

greets from germany!

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: external interrupt atmega

Post by Benj »

Hello,

When reacting to a simple switch you need to setup the hardware so that the pin is pulled to a voltage rail using a resistor when the switch is not pressed and then pulled to the other voltage rail directly when the switch is pressed. The datasheet for the EB007 board has a schematic which should detail exactly what I mean by this.

A keypad must be raster scanned by setting one of the rows high and then sampling each column or visa versa. Not sure how you would make this work via an interrupt on change. One way might be to set all row outputs high and then wait for the interrupt on change to fire which represents one of the keypad switches being pressed or released. When this happens clear all the row pins and then perform the raster scan to collect the active switch press.

manuel_bayer
Posts: 10
Joined: Wed Oct 16, 2013 1:55 am

Re: external interrupt atmega

Post by manuel_bayer »

Yes, i know that i have to use pull-up/Down resistors, but i just simulate the project.
I dont know how the Standard Keypad in flowcode works behind. If it uses multiplexing, maybe if the column-pins are output-pins and the row-pins are input-pins, could i use an interrupt on the 4 Input pins (row-pins) ? So it would react on an User keypress?!

Or cant i use the Standard Keypad from flowcode to do this? Are there better ways to react on keypad-input?
In my Main Loop the Controller compares data, but it should stop the process and call a macro when a keypadbutton is pressed.

Post Reply