版权归钜泉光电科技(上海)有限公司所有应用笔记中文版(260-CS-103)ATT7022B应用笔记版权归钜泉光电科技(上海)有限公司所有应用笔记中文版(260-CS-103)目录一、硬件电路设计··············································································································································3摸拟输入电路·················································································································································3电能脉冲输出电路·········································································································································5电源电路························································································································································7与单片机的接口·············································································································································8判断芯片工作是否正常·································································································································9二、电磁兼容设计················································································································································9PCB布线的说明·············································································································································9通讯······························································································································································14计量参数······················································································································································16计量状态的选择···········································································································································18校表参数······················································································································································19四、软件校表程序示例·······································································································································22版权归钜泉光电科技(上海)有限公司所有应用笔记中文版(260-CS-103)本应用笔记介绍了用ATT7022B做多功能电能表的设计方法,供大家参考,在阅读该应用笔记前,建议先仔细阅读ATT7022B的用户手册。概述ATT7022B是一颗精度高且功能强的多功能防窃电基波谐波三相电能专用计量芯片,它集成了七路二阶sigma-deltaADC,其中三路用于三相电压采样,三路用于三相电流采样,还有一路可用于零线电流或其他防窃电参数的采样,输出采样数据和有效值,使用十分方便,该芯片适用于三相三线和三相四线应用。该芯片还集成了参考电压电路以及所有包括基波、谐波和全波(基波+谐波,以下简称全波)的各项电参数测量的数字信号处理电路,能够测量各相及合相包括基波、谐波和全波有功功率、无功功率、视在功率、有功能量以及无功能量,同时还能测量频率、各相电流及电压有效值、功率因数、相角等参数,提供两种视在电能(PQS、RMS),充分满足三相多功能电能表以及基波谐波电能表制作的需求。ATT7022B内部的电压监测电路可以保证加电和断电时正常工作,提供一个SPI接口,方便与外部MCU之间进行计量参数以及校表参数的传递。支持全数字域的增益、相位校正,即纯软件校表。有功、无功电能脉冲输出CF1、CF2,可以直接接到标准表,进行误差校正,而CF3、CF4输出基波/谐波下的有功和无功电能脉冲或者RMS、PQS视在电能脉冲。一、硬件电路设计ATT7022B封装为44脚QFP形式,外围硬件电路主要包括电源、电压及电流模拟输入、脉冲输出及SPI通讯接口等电路。摸拟输入电路ATT7022B内部集成了7路16位A/D转换器,电流通道有效值在2mV至1V的范围内线性误差小于0.5%;电压通道有效值在10mV至1V的范围内线性误差小于0.5%;电压取值在0.2V到0.6V(放大后的电压值,建议电压取样信号为0.1V,电压通道的放大倍数选4倍),电流取值在2mV至1V,电能线性误差小于0.1%。每路ADC的交流输入由管脚VxP和VxN输入,同时要求VxP、VxN迭加2.4V左右直流偏置电压,该偏置电压可以由芯片的参考电压输出REFOUT获得,也可以由外部基准电压提供。三相表计量芯片的采样电压输入可采用电阻分压方式(如图1和图2)或电压互感器方式(如图3),也可先将电压转换成电流,通过电流互感器,再将电流转换成电压的方式(如图4),后两种方式采用了互感器,将芯片与电网进行了隔离,从而可以获得良好的抗干扰性能。图1将零线VN与芯片的参考电压输出REFO连起来,方便地实现了将交流采样信号迭加在2.4V的偏置直流上,图2的电路将零线与芯片的地连接,适用于电源采用自耦变压器的应用场合。ATT7022B应用笔记中文版(260-CS-103)图1电压采样采用电阻分压输入(零线接参考输出)图2电压采样采用电阻分压输入(零线接地)图3电压采样采用电压互感器输入图6电流采样单端输入图5与图6中IA1、IA2是电流互感器的二次侧信号。第七路ADC输入也可参考这种接法。在采样输入信号设计时应注意以下几点:1、无论任何输入方式,输入引脚的VxP和VxN的直流偏置电压为2.45V左右,偏置电压由芯片的第11脚REFOUT提供,否则不能准确计量。2、为保证测量精度,芯片第5脚外接滤波电容应尽量靠近管脚处,走线粗短,远离其它信号线,且两个电容均不可省去。电容的接地点应与采样信号的地线尽可能短的连在一起。3、VxP和VxN输入电路中电阻1.2K和电容0.01uF构成了抗混叠滤波器,其结构和参数要讲究对称,并采用温度性能较好的元器件,从而保证电表获得良好的温度特性。版权归钜泉光电科技(上海)有限公司所有应用笔记中文版(260-CS-103)4、任意一相电流与电压反向时,芯片第40脚REVP输出高电平,据此可以判断接线是否有错。6、芯片的输入脚SEL接高电平为选择三相四线接线方式,接低电平为选择三相三线接线方式。7、三相三线电表采用两元件测量方式,B相不参与电能计量,端子接线上用VB替代三相四线的VN。电压采样输入V4P与V4N、电流采样输入V3P与V3N可做为独立的信号输入,其电压、电流、功率、功率因数值可读B相相应的寄存器。电能脉冲输出电路下面是有功电能脉冲信号生成的过程框图:版权归钜泉光电科技(上海)有限公司所有电压、电流信号经变换后在DSP中相乘得到瞬时功率,对时间积分后成为电能信号,根据设定的合相能量累加模式将三相电能做绝对值相加或代数值相加运算,并将结果变换为频率信号,然后按照用户设定的分频系数进行分频,得到可用于校表的电能脉冲输出信号。下面是高频输出常数为64时的分频示意图,电能脉冲输出的脉宽为90毫秒,当脉冲周期小于180毫秒时,电能脉冲以占空比为1:1的等宽脉冲输出。无功电能脉冲信号则是DSP中得到的无功瞬时功率,对时间积分后成为无功电能信号,再去生成无功电能脉冲信号,基波、谐波有功和无功也是同样,它们都需要根据设定的合相能量累加模式将三相电能做绝对值相加或代数值相加运算,并将结果变换为频率信号,然后按照用户设定的分频系数进行分频,得到可用于校表的电能脉冲输出信号。脉宽和周期部分的生成都是一样的,其生成的过程总体框图如下:ATT7022B应用笔记中文版(260-CS-103)由上图可见,通过两个寄存器(0x2D和0x3C)的设置,可以开通基波或谐波电能的计量功能。基波测量使能控制寄存器EnLineFreq=0x007812,基波测量与谐波测量切换选择寄存器EnHarmonic≠0x0055AA时,选择基波表模式,此时CF3/CF4分别输出基波有功脉冲和基波无功脉冲;EnLineFreq=0x007812,EnHarmonic=0x0055AA时,选择谐波表模式,此时CF3/CF4分别输出谐波有功脉冲和谐波无功脉冲。基波抽取滤波器和基波抑制器完成基波或者谐波信号处理功能。其中基波抽取滤波器对高于3次(150Hz)以上的谐波信号进行衰减,仅保留基波成分,谐波衰减率在-30dB以上;基波抑制器对基波信号进行衰减,仅保留谐波成分,基波衰减率在-30dB以上,如下图:说明:基波抽取滤波器对高于3次(150Hz)以上的谐波信号进行衰减,仅保留基波成分,谐波衰减率在-30dB以上;版权归钜泉光电科技(上海)有限公司所有应用笔记中文版(260-CS-103)说明:基波抑制滤波器对基波信号进行衰减,仅保留谐