Interrupt auslösen beim ATmega8

tilo
 
Avatar
 
Subject:

Interrupt auslösen beim ATmega8

 · 
Posted: 14.10.2010 - 10:38  ·  #1
Hi,

ich hab schonmal was zu meinem Problem gepostet aber nicht wirklich hilfe bekommen also versuch ichs nochmal.
Also ich bin Anfänger und versuch grad ein kleines Programm mit ein Interrupt zuschreiben.Will aber weder aufm Simulator noch sonst wie funktionieren und hab schon alles mögliche ausprobiert und kann den Fehler einfach nicht finden.Das Programm soll bei einem Signal an PortD.2 ein Interrupt auslösen und in diesem soll eine LED eingeschaltet werden.
Das Problem ist das er nicht den Interrupt auslöst also INTF setzt wenn ich es ausprobieren will, egal wie ich die Register setze ob nun Int1 oder Int0 oder auf welche Flanke er reagieren soll oder sonstwas.

Code

program Interrupts;

{$NOSHADOW}
{ $WG} {global Warnings off}


Device = mega8, VCC=5;
{ $BOOTRST $00C00} {Reset Jump to $00C00}

Define_Fuses
Override_Fuses;
NoteBook = A;
COMport = USB;
LockBits0 = [];
FuseBits0 = [];
FuseBits1 = [];

Import SysTick ;
From System Import ;


Define
ProcClock = 8000000; {Hertz}
SysTick = 10; {msec}
StackSize = $0032, iData;
FrameSize = $0032, iData;

Implementation

{$IDATA}

{--------------------------------------------------------------}
{ Type Declarations }

type


{--------------------------------------------------------------}
{ Const Declarations }

{--------------------------------------------------------------}
{ Var Declarations }
{$IDATA}
var


{--------------------------------------------------------------}
{ functions }
procedure InitPorts;
begin
DDRD := %01100000; //set PinD.5/6 as output
GICR := GICR OR %11000000; //INT0/INT1 activation
MCUCR:= MCUCR or %00001111; //The rising edge of INT1/INT0 generates an interrupt request
GIMSK:= GIMSK or %11000000;
end InitPorts;

Interrupt INT0;
begin
Toggle(PortD.5);
end;
{--------------------------------------------------------------}
{ Main Program }
{$IDATA}

begin
InitPorts;
EnableInts;

loop
nop;
endloop;
end Interrupts. //Programm heißt Interrupts


tilo
Mathias
Benutzer
Avatar
Gender: n/a
Location: Weingarten - Baden
Posts: 307
Registered: 07 / 2003
Subject:

Re: Interrupt auslösen beim ATmega8

 · 
Posted: 14.10.2010 - 17:13  ·  #2
Hallo Tilo,

was ist "GIMSK"?
Im Datenblatt des Mega8 steht nichts darüber.

Ansonsten müßte es funktionieren.

Gruß
Mathias
Gunter
Administrator
Avatar
Gender:
Location: Frankfurt Main / Germany
Posts: 1697
Registered: 02 / 2003
Subject:

Re: Interrupt auslösen beim ATmega8

 · 
Posted: 14.10.2010 - 17:34  ·  #3
ist das Gleiche wie GICR lt. .dsc-File.
Mal nennt es Atmel so, mal so. :'(
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: Interrupt auslösen beim ATmega8

 · 
Posted: 14.10.2010 - 20:54  ·  #4
Nur zur Info,

externe Interrupts werden im Simulator nicht unterstützt!

rolf
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   76   90 · Page-Gen-Time: 0.025017s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI