微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 电源设计 > 电表在不同供电模式下的安全过渡

电表在不同供电模式下的安全过渡

时间:05-14 来源:互联网 点击:

障并进行相应的处理。必须谨慎管理其它中断操作,以避免出现严重的故障现象。

任何情况下,4.8p演示软件都可以在唤醒定时器中保持一个非零数值。正常工作时,唤醒定时器不会计数或触发唤醒过程,除非IC意外进入休眠或仅显示LCD模式。发生这种事件时,将触发唤醒定时器工作,唤醒电表并从故障状态下恢复电表工作。

程序存储位置

目标代码应该把修正程序放置在闪存的前8KB.Keil? IDE中,可以在项目平台更改目标程序,选择点击鼠标右键>optionsBL_51 Locate TabCode Space.演示程序中,该指令置于存储器尽可能低的位置:

C_C51STARTUP,?PR?_?PLL_ISR?BATMODES_20,?PR?_?BATMODE_CHANGE?BATMODES_20, rest of the link commands for code space>

C_C51STARTUP包含演示程序的启动代码。

PR?_?PLL_ISR?BATMODES_20SAFE,?PR?_?BATMODE_CHANGE?BATMODES_20SAFE执行PLL_OK中断例程时需要。

PLL_OK中断

以下程序应该置于PLL_OK中断例程,检测到关断模式时运行。4.8p mainbatmodes_20.c中给出了经过测试的程序代码。

extern void trim_Test(void) small reentrant;

EA = 0;

CONFIG0 = 0; // Make sure we are running as fast as we can.

IFLAGS = (~IE_PLLFALL_) (~IE_PLLRISE_); // force an edge to occur

WAKE = 0x81; // force a wake timer wake if sleep is forced

trim_test(); // From start-up code.
启动程序

以下启动程序用来替代startup.a51,Maxim提供经过测试的软件代码(4.8p演示软件中,启动程序位于utilstartup_n_safe.a51),以下列出了程序代码。

第一次在工厂运行程序时,微调寄存器的内容被复制到闪存内。之后,对微调寄存器进行测试。一旦测试中发生失效,程序将简单地把IC置于休眠模式,然后重新读取微调数据。唤醒器件操作后,IC会自动读取微调保险丝内的数值。复位期间调用保险丝测试程序,将重新读取微调保险丝的数据并进行修正。

;/***************************************************************************
; * This code and information is provided as is without warranty of any *
; * kind, either expressed or implied, including but not limited to the *
; * implied warranties of merchantability and/or fitness for a particular *
; * purpose. *
; * *
; * Copyright (C) 2011 Maxim Integrated Products, Inc. All Rights Reserved. *
; ***************************************************************************/
;//**************************************************************************
;//
;// DESCRIPTION: 71M652x POWER METER - STARTUP Code.
;//
;//**************************************************************************
;//
;// File: STARTUP_N_SAFE.A51.
;//
$NOMOD51
;------------------------------------------------------------------------------
; This file is part of the C51 Compiler package
; Copyright (c) 1988-2002 Keil Elektronik GmbH and Keil Software, Inc.
;------------------------------------------------------------------------------
; STARTUP.A51: This code is executed after processor reset.
;
; To translate this file use A51 with the following invocation:
;
; A51 STARTUP_N_SAFE.A51
;
; To link the modified STARTUP_N_SAFE.OBJ file to your application use the following
; BL51 invocation:
;
; BL51 your object file list>, STARTUP_N_SAFE.OBJ controls>
;
;------------------------------------------------------------------------------
;
; User-defined Power-On Initialization of Memory
; With the following EQU statements the initialization of memory
; at processor reset can be defined:
;
; ; the absolute start-address of IDATA memory is always 0
IDATALEN EQU 100H ; the length of IDATA memory in bytes.
;
XDATASTART EQU 0H ; the absolute start-address of XDATA memory
XDATALEN EQU 000H ; the length of XDATA memory in bytes.
;
PDATASTART EQU 0H ; the absolute start-address of PDATA memory
PDATALEN EQU 0H ; the length of PDATA memory in bytes.
;
; Notes: The IDATA space overlaps physically the DATA and BIT areas of the
; 8051 CPU. At minimum the memory space occupied from the C51
; run-time routines must be set to zero.
;------------------------------------------------------------------------------
;
; Reentrant Stack Initialization
;
; The following EQU statements define the stack pointer for reentrant
; functions and initialized it:
;
; Stack Space for reentrant functions in the SMALL model.
IBPSTACK EQU 1 ; set to 1 if small reentrant is used.
IBPSTACKTOP EQU 0FFH+1 ; set top of stack to highest location+1.
;
; Stack Space for reentrant functions in the LARGE Model.
XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
XBPSTACKTOP EQU 07FFH+1; set top of stack to highest location+1.
;
; Stack Space for reentrant functions in the COMPACT model.
PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
PBPSTACKTOP EQU 07FFH+1; set top of stack to highest location+1.
;
;------------------------------------------------------------------------------
; Page Definition for Using the Compact Model with 64 KByte xdata RAM
;
; The following EQU statements define the xdata page used for pdata
; variables. The EQU PPAGE must conform with the PPAGE control used
; in the linker invocation.
;
PPAGEENABLE EQU 1 ; set to 1 if pdata object are used.
;
PPAGE EQU 7 ; define PPAGE number.
PUBLIC PPAGE_SFR
PPAGE_SFR DATA 0BFH ; SFR that supplies uppermost address byte
; (most 8051 variants use P2 as uppermost address byte)
;------------------------------------------------------------------------------

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top