protegemed, aquisição via A/D simples utilizando interrupção do timer

Dependencies:   EthernetInterface NTPClient mbed-rtos mbed

Fork of ptgm_semDMA by Marcelo Rebonatto

Committer:
viniciushl
Date:
Wed Jan 13 18:53:25 2016 +0000
Revision:
1:8129536051df
Parent:
0:fac116e94d44
Alterada captura para aquisi??o simples do A/D utilizando interrup??o do timer;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rebonatto 0:fac116e94d44 1 /*
rebonatto 0:fac116e94d44 2 * adc.h
rebonatto 0:fac116e94d44 3 *
rebonatto 0:fac116e94d44 4 * Created on: 02/07/2011
rebonatto 0:fac116e94d44 5 * Author: francisco
rebonatto 0:fac116e94d44 6 */
rebonatto 0:fac116e94d44 7
rebonatto 0:fac116e94d44 8 #ifndef ADC_H_
rebonatto 0:fac116e94d44 9 #define ADC_H_
rebonatto 0:fac116e94d44 10
rebonatto 0:fac116e94d44 11
rebonatto 0:fac116e94d44 12 #define PCADC (1U<<12)
rebonatto 0:fac116e94d44 13
rebonatto 0:fac116e94d44 14 #define ADC_CCLK_4 0U
rebonatto 0:fac116e94d44 15 #define ADC_CCLK 1U
rebonatto 0:fac116e94d44 16 #define ADC_CCLK_2 2U
rebonatto 0:fac116e94d44 17 #define ADC_CCLK_8 3U
rebonatto 0:fac116e94d44 18
rebonatto 0:fac116e94d44 19 #define PCLK_ADC 24U
rebonatto 0:fac116e94d44 20
rebonatto 0:fac116e94d44 21 #define ADC_CH_0 (1U<<0)
rebonatto 0:fac116e94d44 22 #define ADC_CH_1 (1U<<1)
rebonatto 0:fac116e94d44 23 #define ADC_CH_2 (1U<<2)
rebonatto 0:fac116e94d44 24 #define ADC_CH_3 (1U<<3)
rebonatto 0:fac116e94d44 25 #define ADC_CH_4 (1U<<4)
rebonatto 0:fac116e94d44 26 #define ADC_CH_5 (1U<<5)
rebonatto 0:fac116e94d44 27 #define ADC_CH_6 (1U<<6)
rebonatto 0:fac116e94d44 28 #define ADC_CH_7 (1U<<7)
rebonatto 0:fac116e94d44 29 #define ADC_CLKDIV(val) ((val)<<8)
rebonatto 0:fac116e94d44 30 #define ADC_MODE_BURST (1U<<16)
rebonatto 0:fac116e94d44 31 #define ADC_OPERATIONAL (1U<< 21)
rebonatto 0:fac116e94d44 32 #define ADC_NO_START ~(7U<<24)
rebonatto 0:fac116e94d44 33 #define ADC_START_NOW (1U<<24)
rebonatto 0:fac116e94d44 34 #define ADC_START_ON_PIO2_10 (2U<<24)
rebonatto 0:fac116e94d44 35 #define ADC_START_ON_PIO1_27 (3U<<24)
rebonatto 0:fac116e94d44 36 #define ADC_START_ON_MAT0_1 (4U<<24)
rebonatto 0:fac116e94d44 37 #define ADC_START_ON_MAT0_3 (5U<<24)
rebonatto 0:fac116e94d44 38 #define ADC_START_ON_MAT1_0 (6U<<24)
rebonatto 0:fac116e94d44 39 #define ADC_START_ON_MAT1_1 (7U<<24)
rebonatto 0:fac116e94d44 40 #define ADC_EDGE_FALLING (1U<<27)
rebonatto 0:fac116e94d44 41 #define ADC_EDGE_RAISING ~(1U<<27)
rebonatto 0:fac116e94d44 42
rebonatto 0:fac116e94d44 43 #define ADC_GLOBAL_INT (1U<<8)
rebonatto 0:fac116e94d44 44 #define ADC_INT_CH_0 (1U<<0)
rebonatto 0:fac116e94d44 45 #define ADC_INT_CH_1 (1U<<1)
rebonatto 0:fac116e94d44 46 #define ADC_INT_CH_2 (1U<<2)
rebonatto 0:fac116e94d44 47 #define ADC_INT_CH_3 (1U<<3)
rebonatto 0:fac116e94d44 48 #define ADC_INT_CH_4 (1U<<4)
rebonatto 0:fac116e94d44 49 #define ADC_INT_CH_5 (1U<<5)
rebonatto 0:fac116e94d44 50 #define ADC_INT_CH_6 (1U<<6)
rebonatto 0:fac116e94d44 51 #define ADC_INT_CH_7 (1U<<7)
rebonatto 0:fac116e94d44 52
rebonatto 0:fac116e94d44 53 #define ADC_LAST_CONVERSION() ((LPC_ADC->ADGDR&(0xFFFU<<4))>>4)
rebonatto 0:fac116e94d44 54 #define ADC_LAST_CONVERSION_CHANNEL() ((LPC_ADC->ADGDR&(7U<<24))>>24)
rebonatto 0:fac116e94d44 55 #define ADC_LAST_CONVERSION_DONE() (LPC_ADC->ADGDR&(1U<<31))
rebonatto 0:fac116e94d44 56 #define ADC_LAST_CONVERSION_OVERUN() (LPC_ADC->ADGDR&(1U<<30))
rebonatto 0:fac116e94d44 57 #define ADC_CONVERSION_CH(ch) ((LPC_ADC->ADDR[ch]&(0xFFFU<<4))>>4)
rebonatto 0:fac116e94d44 58 #define ADC_CONVERSION_DONE_CH(ch) (LPC_ADC->ADDR[ch]&(1U<<31))
rebonatto 0:fac116e94d44 59 #define ADC_CONVERSION_OVERUN_CH(ch) (LPC_ADC->ADDR[ch]&(1U<<30))
rebonatto 0:fac116e94d44 60
rebonatto 0:fac116e94d44 61 #define ADC_CONVERT(val) ((val&(0xFFFU<<4))>>4)
rebonatto 0:fac116e94d44 62 #define ADC_CHANNEL(val) ((val&(7U<<24))>>24)
rebonatto 0:fac116e94d44 63
rebonatto 0:fac116e94d44 64 #ifdef __cplusplus
rebonatto 0:fac116e94d44 65 extern "C" {
rebonatto 0:fac116e94d44 66 #endif
rebonatto 0:fac116e94d44 67
rebonatto 0:fac116e94d44 68 extern void init_adc(int adc_clk);
rebonatto 0:fac116e94d44 69 extern void setup_start(int mode,int edge);
rebonatto 0:fac116e94d44 70 extern void select_channels(int adc_ch);
rebonatto 0:fac116e94d44 71
rebonatto 0:fac116e94d44 72 #ifdef __cplusplus
rebonatto 0:fac116e94d44 73 }
rebonatto 0:fac116e94d44 74 #endif
rebonatto 0:fac116e94d44 75
rebonatto 0:fac116e94d44 76 #endif /* ADC_H_ */