多功能电表软件系统设计
电能表的软件系统包括程序数据结构模块、程序初始化与电表运行处理模块、事件分配查询管理处理模块及显示处理模块、通讯处理模块、电量处理模块、时间与时段管理处量模块、电表最大需量处理模块八大部分组成,各个部分都有其特殊的任务,在电表系统中完成它们相应的功能。●●●●程序数据结构部分●●●●●●●●●程序数据结构部分程序数据结构模块是对程序中的数据进行分析,合理的分配数据内存,定义程序涉及的变量。它是根据整个程序的算法来制定的,同时一个好的数据结构对整个程序的编写有非常重要的作用,因此根据电能表软件系列实现的功能及其算法制定合理的数据结构。电能表的数据结构包括两个部分:内存数据结构和数据结构与常量结构。●这个是与常量的数据结构,在显小与数据通讯都会使用这个结构●●●●●●●●●程序常量数据结构部分●●●●数据标示项数据标示表示的正反数据存放的格式数据值的长度数据在与的偏移量数据显示的符号通过此结构可以把所要显示、通讯的数据在或者在存放的位置长度以极标志等内睿取出供所需要的函数使用●●●●程序数据结构部分●●●●●●●●●合相有功功率合相有功瞬时功率电压有校值合电流有校值当前的线频率合功率因数合相电压与电流的夹角当前的电能此结构可以对的计量参数寄存器一次可以全读出,并同时也可以分别取出对应所需要的参数●●●●●●●●●程序初始化与电表运行处理●●●●程序初始化与电表运行处理●程序初始化与电表运行处理模块是对整个程序进行初始化,并对电表运行的六种状态进行转换。程序初始化包括两个部分:初始化和电表各部件初始化。初始化是对各部件进行初始化,为各部件在程序工作时提供合适的初始状态,它包括配置口工作模式、看门狗初始化、定时器初始化、键盘中断初始化、串口中断初始化、初始化等等。电表各部件初始化是对电能表系统各部件进行配置工作状态,初始化它们的工作方式,为程序工作提供电表部件初始状态,它包括指示灯初始化显示初始化、实时时钟初始化、电量恢复、通讯信道、历史电量处理等等部件的初始化。●●●●口工作模式●●●●●●●●●口工作模式如果有没有用到的口,作输入时要通过电阻与或者与连接,作输出时要输出置与置因为设备输入端未连接将会产生工作枚障,如果输入未连接,则由于噪音等原因可能会产生内部输入电平,从而导致故障。如果在上电时口为输入,但电池供电时口的电平为不确定状态时,也应对口作相应的处理●当主时钟切换到副时钟时,应将主时钟的口设为输出置看门狗初始化●●●●●●●●可选字节设定地址:080H/Ls0HrWINDOW1F工NDOWWDCSWDCS1WDCSLSROSC看门狗的开了NDCW1VINDOMO看门狗定封器窗口打开周期窗时间设定为1C5WDTCN看门狗定时器计数器的操作控制/非法汸问检测琹止计数器操怍复位后停止计数),禁止非法访问检测操作允许计数器橾作;愆位后始计敏),氘许非法访闻枱测橾作看门狗定时器HD,FDCS1HDCEO昋门狗定时器溢出吋间0z°/faL(3.88ms)时间间隔设置n/f!(7.76ms):25/土R(3L.03ms0CTL (62, OG sD0125fsL(124.12mE)fL(496.4LSROSC内部低速振蓠器操作看门狗设为不可由软件停1(出将1写入C寄存器的第0红 SESTOP)时停l操作不能停止(即使将1写入 SRSTOP位也不停止操作)能停止单片机内部的看门狗把设为不能停止时为硬看门狗,必须在窗口打开才能清狗否则单片机会复位,●●●●串口中断初始化●●●●●●●●●●由于多功能表有二个供通讯的口,一个供红外通讯口。但单片机只有二个哪么就需要模拟其中一个的分频时钟信号不能得到此时应选的分分频时钟信号模拟红外通讯,需要个外部中断(接收接收管上的电平信号并每要检测屮断口的信号),二个定时器(输出载波与的时间间隔)串口中断初始化有关UART0的寄存器波特率发生控制寄存器0( BRGCO)真出:F? iH Aher reset: 1Fh民WEymarBRGCOTPE01TP90O0 MDLO4MPLSMDLDe MDLoTBLOm(TPS01,TPS00)=(0,0)选择定时器TM50的输出作为TPSDTP500Base cock (IxeLKol selection"fPRs=2 MHz fFRE-5 MHz fFRs-B MHz1FFG-10MH基本时钟TM50 DutpfEgli1 H25 H4 HT5 MHz250kF2H25 kHz1 MH26H2625kH15625kH2250H3125k因为如果选择外围硬件时钟fprs作为基本时钟,那么就不可能产生出1200bps的波特率。MDLO4MDLOS MDLO2 MDLOT MDLOG k Selectian of 5-titcounterx Selng Erchbiled0acLM/B0(MDLO4, MDL03, MDLO2MDL01,ML00)=(0,1,1,0,1),k=13028 fruTa2a scLk/?31t/3
- 2020-11-30下载
- 积分:1
Lumped Elements for RF and Microwave Circuits (Bahl 2003)
Lumped Elements for RF and Microwave Circuits英文版,射频微波电路入门Lumped Elements for RFand microwave circuitsFor a listing of recent titles in the Artech House Microwave library,turn to the back of this bookLumped Elements for RFand microwave circuitsInder bahlArtech houseBoston londonwww.artechhouse.comLibrary of Congress Cataloging-in-Publication DataBahl, I.J.Lumped elements for RF and microwave circuits /Inder Bahlp cm.--(Artech House microwave libraryncludes bibliographical references and indexISBN 1-58053-309-4(alk. paper1. Lumped elements(Electronics) 2. Microwave integrated circuits. 3. Radiofrequency integrated circuits. 4. Passive components. I. Title. II. SeriesTK7874.54B342003621.38132-dc212003048102British Library Cataloguing in Publication DataBahl, I. J. Inder jit)Lumped elements for RF and microwave circuits.-(Artech House microwave library1. Radio circuits 2. Microwave circuits I. Title621.38412ISBN1-58053-3094Cover design by Igor Valdmar2003 ARTECH HOUSE, INC.685 Canton StreetNorwood Ma 02062All rights reserved Printed and bound in the United States of America. no part of this bookmay be reproduced or utilized in any form or by any means, electronic or mechanical, includingphotocopying, recording, or by any information storage and retrieval system, without permissionn writing from the publisherall terms mentioned in this book that are known to be trademarks or service marks have beenappropriately capitalized. Artech House cannot attest to the accuracy of this information. Useof a term in this book should not be regarded as affecting the validity of any trademark or servicemarkInternational Standard Book Number: 1-58053-309-4Library of Congress Catalog Card Number: 200304810210987654321To my adorable grandsons, Karan and Rohan Kaushal, with whom I play, cry,and laugh, and who have provided me with the idea and inspiration towrite this bookContentsPrefaceXVAcknowledgmentsXXIntroduction1.1 History of Lumped Elcements)Why Use Lumped Elements for rF andMicrowave circuits1.3 L, C, R Circuit Elements1.4 Basic Design of Lumped Elements4.1 Capacitor1.4.2 Inductor4.3 Resistorumped-Element Modelin1. 6 Fabrication1.7 ApplicationsReferencesInductors2.1 IntroductionLumped Elements for RF and Microwave Circuits2.2 Basic Definitions2.2.1 Inductance2.2.2 Magnetic Energy182.2.3 Mutual Inductance202. 2. 4 Effective Inductance202.2.5Imedang2.2.6 Time Constant2.2.7 Quality Factor222.2.8 Self-Resonant Frequency232.2.9aximum Current Ratin2.2.10 Maximum Power Rating2.2.11 Other Parameters232.3 Inductor Configurations242.4 Inductor models2. 4. 1 Analytical Models252.4.2 Coupled-Line Appiroach282.4.3 Mutual Induse arppi342.4.4 Numerical Approach362.4.5 Measurement-Based model382.5 Coupling Between Inductors452.5. 1 Low-Resistivity Substrates2.5.2 High-Resistivity Substrates462.6 Electrical Representations2.6. 1 Series and Parallel representations2.6.2 Network Representations51References52Printed Inductors573.1 Inductors on Si Substrate583.1.1 Conductor Loss3.1.2 Substrate Loss3. 1.3 Layout Considerations3.1.4 Inductor Model3. 1.5 Q-Enhancement Techniques3.1.6 Stacked-Coil Inductor803.1.7 Temperature Dependence84
- 2021-05-07下载
- 积分:1