You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: SBMInfo/ADCUtils.h
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,7 @@
31
31
32
32
// External Reference Current is 150 uA for 5 V and 100 uA for 3.5 V
33
33
#defineREADING_FOR_AREF 1024L // Datasheet 24.2: The minimum value represents GND and the maximum value represents the voltage on the AREF pin minus 1 LSB
34
+
#defineMAX_ADC_VALUE 1023L
34
35
35
36
// PRESCALE4 => 13 * 4 = 52 microseconds per ADC conversion at 1 MHz Clock => 19,2 kHz
36
37
#defineADC_PRESCALE2 1 // 26 microseconds per ADC conversion at 1 MHz
Copy file name to clipboardExpand all lines: SBMInfo/ADCUtils.hpp
+51-2Lines changed: 51 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@
42
42
* with INTERNAL you can calibrate your ADC readout. For my Nanos I measured e.g. 1060 mV and 1093 mV.
43
43
*/
44
44
#if !defined(ADC_INTERNAL_REFERENCE_MILLIVOLT)
45
-
#defineADC_INTERNAL_REFERENCE_MILLIVOLT1100L// Change to value measured at the AREF pin. If value > real AREF voltage, measured values are > real values
45
+
#defineADC_INTERNAL_REFERENCE_MILLIVOLT1100UL// Change to value measured at the AREF pin. If value > real AREF voltage, measured values are > real values
46
46
#endif
47
47
48
48
// Union to speed up the combination of low and high bytes to a word
@@ -85,6 +85,27 @@ uint8_t sVCCTooLowCounter = 0;
85
85
86
86
/*
87
87
* Conversion time is defined as 0.104 milliseconds by ADC_PRESCALE in ADCUtils.h.
88
+
* Use previous settings
89
+
*/
90
+
uint16_treadADCChannel() {
91
+
WordUnionForADCUtils tUValue;
92
+
93
+
// ADCSRB = 0; // Only active if ADATE is set to 1.
94
+
// ADSC-StartConversion ADIF-Reset Interrupt Flag - NOT free running mode
0 commit comments