?? sd16.c
字號:
/********************************************************************************
* 杭州利爾達(dá) *
* MSP430FE42X單相防竊電多功能電表平臺 *
* ----- ESP SD16實(shí)現(xiàn) *
* *
* *
* 說明:本軟件為杭州利爾達(dá)單相防竊電多功能電表DEMO軟件 *
* *
*********************************************************************************/
#include "msp430xe42x.h"
#include "globe.h"
#include "emeter_cfg.h"
#include "extern_function.h"
/* The following are the front end gains to be used for an SD16's three ADCs */
#define CURRENT_CH_1_GAIN SD16GAIN_1
#define CURRENT_CH_2_GAIN SD16GAIN_16
#define VOLTAGE_CH_GAIN SD16GAIN_1
#define SD16CONF0_FUDGE 0xC0
#define SD16CONF1_FUDGE 0x40
/*
* Analog front-end initialization routine.
*
* Configures the sigma-delta ADC module as analog front-end for
* a tamper-resistant meter using a current transformer and a
* shunt as current sensors (see configuration of channel 0 and 1).
*/
void init_analog_front_end_SD16(void)
{
/*
* First it makes sure that the Embedded Signal Processing is
* disabled, otherwise it will not be possible to modify the
* SD16 registers.
*/
ESPCTL &= ~ESPEN;
/*
* Then the general configurations of the analog front-end are done
* that apply to all channels: clock selection (SMCLK) and divider
* settings (depending on SMCLK frequency) and reference voltage
* selections.
*/
SD16CTL = 0x800
| SD16SSEL_1 /* Clock is SMCLK */
| SD16DIV_2 /* Divide by 8 => ADC clock: 1.048576MHz */
| SD16REFON /* Use internal reference */
| SD16LP;
/*
* For the configuration of the analog front-end channel 0 (Current 1)
* the following example is used:
* \par Current transformer
* (e.g. T60404-E4623-X101 from VAC (http://www.vacuumschmelze.com))
* - Turn ratio: 2500
* - Burden resistor: RB = 18.8Ohm
* - Phase error at 50Hz: 4.15
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -