[Ktechlab-devel] Interrupts in PICs
Rodolfo Zitellini
xhero.gm at gmail.com
Tue Apr 11 13:16:39 UTC 2006
Hi All,
Interrups seemed not working in the pic simulator, so I made a little
patch for gpsimprocessor.cpp that enables them. It works fine for me
(tested it a lot using tmr0 overflow), hope it can be of help for
someone else too.
Rodolfo
-- begin interrupts.patch ---
--- ktechlab.orig/src/electronics/gpsimprocessor.cpp 2006-04-11
15:00:49.000000000 +0200
+++ ktechlab/src/electronics/gpsimprocessor.cpp 2006-04-11
15:11:08.000000000 +0200
@@ -245,16 +245,23 @@
unsigned long long beforeExecuteCount = get_cycles().get();
- m_pPicProcessor->step_one(false); // Don't know what the false
is for; gpsim ignores its value anyway
-
- // Some instructions take more than one cycle to execute, so
ignore next cycle if this was the case
- if ( (get_cycles().get() - beforeExecuteCount) > 1 )
- m_bCanExecuteNextCycle = false;
+ if(get_bp().have_interrupt())
+ {
+ m_pPicProcessor->interrupt();
+ }
+ else
+ {
+ m_pPicProcessor->step_one(false); // Don't know what
the false is for; gpsim ignores its value anyway
+
+ // Some instructions take more than one cycle to
execute, so ignore next cycle if this was the case
+ if ( (get_cycles().get() - beforeExecuteCount) > 1 )
+ m_bCanExecuteNextCycle = false;
+ }
currentDebugger()->checkForBreak();
- // Let's also update the values of RegisterInfo every 50 milliseconds
- if ( (beforeExecuteCount % 20000) == 0 )
+ // Let's also update the values of RegisterInfo every 25 milliseconds
+ if ( (beforeExecuteCount % 10000) == 0 )
registerMemory()->update();
}
-- end interrupts.patch --
More information about the Ktechlab-devel
mailing list