MSPM0_ValvanoWare
1.0
ECE445L starter code
inc
ADC1.h
Go to the documentation of this file.
1
/* ADC1.h
2
* Students put your names here
3
* Modified: put the date here
4
* 12-bit ADC input on ADC1 channel 5, PB18
5
*/
6
23
#ifndef __ADC1_H__
24
#define __ADC1_H__
25
34
void
ADCinit
(
void
);
35
// write code to initialize ADC1 channel 5, PB18
36
// Your measurement will be connected to PB18
37
// 12-bit mode, 0 to 3.3V, right justified
38
// software trigger, no averaging
39
46
uint32_t
ADCin
(
void
);
47
// write code to sample ADC1 channel 5, PB18 once
48
// return digital result (0 to 4095)
49
50
57
uint32_t
Convert
(uint32_t input);
58
// determine constants k1 k2 to fit Position=(k1*Data + k2)>>12
59
60
67
float
FloatConvert
(uint32_t input);
68
// do not use this function
69
// it is added just to show you how SLOW floating point in on a Cortex M0+
70
71
#endif
// __ADC1_H__
ADCinit
void ADCinit(void)
Initialize ADC.
ADCin
uint32_t ADCin(void)
Input from PB18.
Convert
uint32_t Convert(uint32_t input)
Input from PB18.
FloatConvert
float FloatConvert(uint32_t input)
Input from PB18.
Generated by
1.9.1