test AnalogIn_Diff.lib for board K64F
Dependencies: AnalogIn_Diff_ok mbed
Diff: main.cpp
- Revision:
- 6:4bdadb8765ba
- Parent:
- 5:f994e394a7ec
- Child:
- 7:e1a6763c6da2
diff -r f994e394a7ec -r 4bdadb8765ba main.cpp
--- a/main.cpp Wed Jul 30 13:09:49 2014 +0000
+++ b/main.cpp Thu Jul 31 11:49:04 2014 +0000
@@ -3,7 +3,7 @@
#include "math.h"
#include "MovingAverage.h"
-#define VERSION "30_07_2014"
+#define VERSION "31_07_2014"
#define CIBLE "K64F"
#define max(a,b) (a>=b?a:b)
@@ -54,9 +54,10 @@
{
float val;
+ int32_t val_i32;
led1=1;
- int32_t val_i32=a2d.read_16(NCHANNEL);
+ val_i32=a2d.read_16(NCHANNEL);
val=(float)val_i32*adc_volt.gain-adc_volt.offset;
moy.Insert(val);
@@ -69,11 +70,13 @@
timer_min.reset();
timer_min.start();
F_timer_min = true;
+ min=UAC_NON2;
}
if(val_i32>UAC_MAX2 && F_timer_max ==false) {
timer_max.reset();
timer_max.start();
F_timer_max = true;
+ max=UAC_NON2;
}
//STOP
if(val_i32>UAC_MIN2 && F_timer_min ==true) {
@@ -85,11 +88,11 @@
timer_max.stop();
F_timer_max = false;
}
- if(timer_min.read_ms()>20) {
+ if(timer_min.read_ms()>20 && F_timer_min ==true) {
time_min=timer_min.read_ms();
min=min(val_i32,min);
}
- if(timer_max.read_ms()>20) {
+ if(timer_max.read_ms()>20 && F_timer_max ==true) {
time_max=timer_max.read_ms();
max=max(val_i32,max);
}
frederic blanc
ADC DIFF K64F