summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradrian-bowyer <adrian-bowyer>2007-09-15 10:46:26 +0000
committeradrian-bowyer <adrian-bowyer@cb376a5e-1013-0410-a455-b6b1f9ac8223>2007-09-15 10:46:26 +0000
commit613c6f48c227f047715d690ac85530d98c2fdb8f (patch)
treef1840e6804832e113b0d16f173fb411501250af5
parent7cd34409cb44e701eb94836acfb43a6b3de56139 (diff)
downloadreprap-613c6f48c227f047715d690ac85530d98c2fdb8f.tar.gz
reprap-613c6f48c227f047715d690ac85530d98c2fdb8f.zip
Flag added to temperature timer to discard times when an interrupt has happened.
git-svn-id: https://reprap.svn.sourceforge.net/svnroot/reprap@921 cb376a5e-1013-0410-a455-b6b1f9ac8223
-rw-r--r--branches/autoconf-firmware/devices/extruder_0/extruder.h1
-rw-r--r--branches/autoconf-firmware/devices/extruder_0/extruder1.c2
-rw-r--r--branches/autoconf-firmware/devices/extruder_0/extruder2.c26
3 files changed, 19 insertions, 10 deletions
diff --git a/branches/autoconf-firmware/devices/extruder_0/extruder.h b/branches/autoconf-firmware/devices/extruder_0/extruder.h
index 64469031..cbb44020 100644
--- a/branches/autoconf-firmware/devices/extruder_0/extruder.h
+++ b/branches/autoconf-firmware/devices/extruder_0/extruder.h
@@ -12,6 +12,7 @@ void timerTick();
void checkTemperature();
extern byte PWMPeriod;
+extern byte temp_counting;
#ifdef UNIVERSAL_PCB
// RA0 is L298 4 (Fan)
diff --git a/branches/autoconf-firmware/devices/extruder_0/extruder1.c b/branches/autoconf-firmware/devices/extruder_0/extruder1.c
index 135c2cb9..e32d2ffa 100644
--- a/branches/autoconf-firmware/devices/extruder_0/extruder1.c
+++ b/branches/autoconf-firmware/devices/extruder_0/extruder1.c
@@ -55,7 +55,7 @@ static void isr() interrupt 0 {
timerTick();
TMR1IF = 0;
}
-
+ temp_counting = 0;
}
void init1()
diff --git a/branches/autoconf-firmware/devices/extruder_0/extruder2.c b/branches/autoconf-firmware/devices/extruder_0/extruder2.c
index 2c2a0882..5ee8175a 100644
--- a/branches/autoconf-firmware/devices/extruder_0/extruder2.c
+++ b/branches/autoconf-firmware/devices/extruder_0/extruder2.c
@@ -47,6 +47,7 @@ volatile static byte lastPortB = 0;
volatile static byte lastPortA = 0;
volatile static byte extrude_click = 0;
volatile static byte material_click = 0;
+byte temp_counting;
static byte requestedHeat0 = 0;
static byte requestedHeat1 = 0;
@@ -417,17 +418,20 @@ void checkTemperature()
TRISA = BIN(10000010) | PORTATRIS;
portaval = val | BIN(01000000);
PORTA = portaval;
+ temp_counting = 1;
GIE = 1;
// Wait for cap to reach vref
TMR0 = 0;
while (C2OUT)
;
- if (T0IF)
- lastTemperatureRef = 255;
- else
- lastTemperatureRef = TMR0;
-
+ if(temp_counting)
+ {
+ if (T0IF)
+ lastTemperatureRef = 255;
+ else
+ lastTemperatureRef = TMR0;
+ }
// Discharge cap
// Set A1 to low, float others
PORTA = portaval;
@@ -452,6 +456,7 @@ void checkTemperature()
portaval = val | BIN(10000000);
PORTA = portaval;
TRISA = BIN(01000010) | PORTATRIS;
+ temp_counting = 1;
GIE = 1;
// Use 8 bit Timer0 to measure time
@@ -459,10 +464,13 @@ void checkTemperature()
TMR0 = 0;
while (C2OUT)
;
- if (T0IF)
- lastTemperature = 255;
- else
- lastTemperature = TMR0;
+ if(temp_counting)
+ {
+ if (T0IF)
+ lastTemperature = 255;
+ else
+ lastTemperature = TMR0;
+ }
// Discharge cap
// Set A1 to low, float others