多功能电表软件系统设计
电能表的软件系统包括程序数据结构模块、程序初始化与电表运行处理模块、事件分配查询管理处理模块及显示处理模块、通讯处理模块、电量处理模块、时间与时段管理处量模块、电表最大需量处理模块八大部分组成,各个部分都有其特殊的任务,在电表系统中完成它们相应的功能。●●●●程序数据结构部分●●●●●●●●●程序数据结构部分程序数据结构模块是对程序中的数据进行分析,合理的分配数据内存,定义程序涉及的变量。它是根据整个程序的算法来制定的,同时一个好的数据结构对整个程序的编写有非常重要的作用,因此根据电能表软件系列实现的功能及其算法制定合理的数据结构。电能表的数据结构包括两个部分:内存数据结构和数据结构与常量结构。●这个是与常量的数据结构,在显小与数据通讯都会使用这个结构●●●●●●●●●程序常量数据结构部分●●●●数据标示项数据标示表示的正反数据存放的格式数据值的长度数据在与的偏移量数据显示的符号通过此结构可以把所要显示、通讯的数据在或者在存放的位置长度以极标志等内睿取出供所需要的函数使用●●●●程序数据结构部分●●●●●●●●●合相有功功率合相有功瞬时功率电压有校值合电流有校值当前的线频率合功率因数合相电压与电流的夹角当前的电能此结构可以对的计量参数寄存器一次可以全读出,并同时也可以分别取出对应所需要的参数●●●●●●●●●程序初始化与电表运行处理●●●●程序初始化与电表运行处理●程序初始化与电表运行处理模块是对整个程序进行初始化,并对电表运行的六种状态进行转换。程序初始化包括两个部分:初始化和电表各部件初始化。初始化是对各部件进行初始化,为各部件在程序工作时提供合适的初始状态,它包括配置口工作模式、看门狗初始化、定时器初始化、键盘中断初始化、串口中断初始化、初始化等等。电表各部件初始化是对电能表系统各部件进行配置工作状态,初始化它们的工作方式,为程序工作提供电表部件初始状态,它包括指示灯初始化显示初始化、实时时钟初始化、电量恢复、通讯信道、历史电量处理等等部件的初始化。●●●●口工作模式●●●●●●●●●口工作模式如果有没有用到的口,作输入时要通过电阻与或者与连接,作输出时要输出置与置因为设备输入端未连接将会产生工作枚障,如果输入未连接,则由于噪音等原因可能会产生内部输入电平,从而导致故障。如果在上电时口为输入,但电池供电时口的电平为不确定状态时,也应对口作相应的处理●当主时钟切换到副时钟时,应将主时钟的口设为输出置看门狗初始化●●●●●●●●可选字节设定地址: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
Simplorer内部培训资料
Simplorer V9的培训资料,非常详细,一共407页的PDF,看完这个PDF,相信你已经是simplorer高手了。Conventions Used in this GuideGetting HelpAnsoft Technical SupportHelp MenuContext-Sensitive Help1. IntroductionOverview of the Simplorer Interface .........1-32. Creating a New ProjectAbout the three-Phase rectifier2-2Expected Results2-3Using Simplorer to Create and Improve the Design2-4Creating the new project2-5Add the New project2-5Rename the designAdd Design Notes(Optional)Save the New project2-73. Create the rectifier modelCreate the Three-Phase rectifier Schematic. 3-2Choosing, Placing, and Arranging Components onthe schematic she.3-3Connecting the Components3-8Defining Component Properties3-9Property Displays for Components3-13Specifying simulation Outputs.3-16Defining Solution Options and Analysis Parameters3-18Starting an Analysis3-19Plotting Rectifier Model Simulation Results3-204. Hysteresis Current-Controlled DC-Motor Start-UpModify the Rectifier Model Design.4-2Deleting the Resistive/Inductive Load,4-3Saving the sheet with a New Name4-3Place and Arrange the New Components4-4Connect the New Components.,,,,,,4-5Defining dc Machine valuesDefining Mechanical Load4-7Freewheeling Diode4-8Chopper Transistor4-8Controller Modeling using block elements..4-9Modifying Report Elements...4-11Display Diode CharacteristicDefining Simulation Parameters.4-13Starting Simulation(Block Components.4-13Simulation Results(Block Components)... 4-14Controller Modeling Using State Graph Components4-15Connecting the State Graph Components4-16Defining Properties of State Graph Components 4-Using Name References4-19Deactivating Components on the sheet4-19Starting Simulation(State Graph)...4-21Simulation Results(State Graph)4-225. Current and Speed Controlled Dc MotorModify the State graph design5-2Deleting the State GraphSaving the sheet with a New namePlacing and Arranging the New Block Componentson the sheet5-4Connecting the New ComponentsDefining Mechanical Load (Block)Defining the pl controller.........5-8Starting Simulation..5-12Adding a Rectangular Plot(Pl Controller)... 5-13Adjusting Plot Properties.5-14Checking the block Sequence..5-16Using Automatic Block Sorting5-16Using Manual Block Sorting5-16Rerun the Simulation(PI Controller)Simulation Results(PI Controller)5-176. Using VHDL-AMS Components forModelingVHDL-AMS Components,,,,.6-2Modify the pl controller Design.6-3Save the project with a new name6-3Delete the dc Machine component6-4Placing and Arranging the New VHDL-AMs Components on the sheet6-4Connecting the New VHDL-AMS Components 6-4Defining VHDL-AMS DC Machine values6-4Defining Connections for Machine Current..6-5Defining Simulation ParametersAnalyze and Display Simulation Results(VHDLAMS6-67. Variants of PWM ModelingPWM Modeling Overview7-2Create a New Project for the pWm models ..7-3Setting Initial ConditionsPWM Modeling Using EquationsDefining Simulation Parameters7-4Displaying Simulation Results with Reports 7-4Simulation results 7-6PWM Modeling with Equations and Time Function7-6PWM Modeling with State Graph Components 7-8Place and arrange the components on the sheet7-8Define Component properties翻国7-9PWM Modeling with Block Diagram Components 7Placing and Arranging the Components on theSheet7-118. Importing Legacy SchematicsTranslating a Legacy Schematic..8-2Importing the legacy Schematic8-2Starting an analysis...,,8-6Plotting Simulation Results8-7Estimated time tooplete this guide45 minutes
- 2020-11-27下载
- 积分:1