📄 ka.asm
字号:
Rd_Current_time EQU 6 ;读当前时间
Rd_met_para EQU 5 ;读电表运行参数
Rd_epm_kWh_bk EQU 4 ;1--读电量备份
;
Wt_e2pm_kWh EQU 3 ;写"电量"标志
;--------------------------------------------------------------
;
;------------------------------------------------------
; INTCON,PIR1
;------------------------------------------------------
INTF EQU 1 ;RB0标志位
T0IF EQU 2 ;定时器0中断标志位
;;;
ADIF EQU 6 ;16C73新增的.
RCIF EQU 5 ;串行(SCI)接收中断标志位
TMR1IF EQU 0 ;定时器1中断标志位
;-----------------------------------------------------
; ----- PIE1------
;-----------------------------------------------------
ADIE EQU 6 ;16C73新增的.
RCIE EQU 5
TXIE EQU 4
TMR1IE EQU 0
;-----------------------------------------------------
;------------ADCON0-----------------------------------
GO EQU 2 ;A/D转换启动.
ADIF1 EQU 1 ;A/D finished stat bit
ADON EQU 0 ;A/D转换允许
;-----------------------------------------------------
; TXSTA,RCSTA
;-----------------------------------------------------
BRGH EQU 2
SYNC EQU 4
TX89 EQU 6 ;???
TXEN EQU 5
TXD8 EQU 0 ;???
SPEN EQU 7
RC89 EQU 6
CREN EQU 4
;-------------------------------------------------
; Define Constant FOR AT24C16
;-------------------------------------------------
bSLAVE EQU h'0A0' ;2004
aSlave0 EQU h'0A0'
aSlave1 EQU h'0A2'
aSlave2 EQU h'0A4'
aSlave3 EQU h'0A6'
aSlave4 EQU h'0A8'
aSlave5 EQU h'0AA'
aSlave6 EQU h'0AC'
aSlave7 EQU h'0AE'
;-----------------------------------------
LCD_SLAVE EQU h'7C'
;MODE1 EQU 50h ;1/3, 1:4, SAVE Engry, Clear display
;MODE2 EQU 58h ;1/3, 1:4, Save Engry, Clear display
Lcd_SubAdr equ 80h
mode1 equ 0D8h
Rtc_SLAVE equ 0A2h ;Real time colock Ic ddress
;-------------------------------------------------
;----------------------------------------------------------------
;----------------------------------------------------------------
; EEPROM Blocks 0 Address (000h---0FFh), aSlave0
;----------------------------------------------------------------
Epm_init_flag EQU 10h ; 8 bytes
;
Epm_Mter_Add EQU 20h ; 6 bytes
Epm_Mter_Pws EQU Epm_Mter_Add+6 ; 3 bytes
Epm_Mter_Num EQU Epm_Mter_Pws+3 ; 6 bytes
;-------------
Epm_User_Num EQU 30h ; 6 bytes
Epm_Constat EQU Epm_User_Num+6 ;表常数 2 bytes
Epm_Record_Day EQU Epm_Constat+2 ;结算日 1 bytes
Epm_disp_digit EQU Epm_Record_Day+1 ;显示小数位数,1 byte
Epm_disp_time EQU Epm_disp_digit+1 ;显示时间 2 byte
Epm_dsp_flag1 EQU Epm_disp_time+2 ; 1 bytes
Epm_dsp_flag2 EQU Epm_dsp_flag1+1 ; 1 bytes
;;
Epm_Tolt_kWh EQU 40h ;当月总 4 bytes
Epm_Peak_kWh EQU Epm_Tolt_kWh+4 ;当月峰 4 bytes
Epm_Flat_kWh EQU Epm_Peak_kWh+4 ;当月平 4 bytes
Epm_Vale_kWh EQU Epm_Flat_kWh+4 ;当月谷 4 bytes
;;
Epm_Revers_kWh EQU 50h ;当月反 4 bytes
Ep_program_count equ Epm_Revers_kWh+4 ;编程次数 2 byte(NULL 1)
;;
Ep_program_time equ Ep_program_count+2 ;编程时间(月,日,时,分)4byte
Epm_kWh_Tst_Word EQU Ep_program_time+5 ;当月test word 1 bytes
;;
Pre_Tolt_kWh EQU 60h ;上月总,4 bytes
Pre_Peak_kWh EQU Pre_Tolt_kWh+4 ;上月峰,4 bytes
Pre_Flat_kWh EQU Pre_Peak_kWh+4 ;上月平,4 bytes
Pre_Vale_kWh EQU Pre_Flat_kWh+4 ;上月谷,4 bytes
;
Pre_Revers_kWh EQU 70h ;上月反,4 bytes
Pre_kWh_Tst_Word EQU Pre_Revers_kWh+4 ;上月test word,1 bytes
;
;
Epm_met_Time1 EQU 80h ;费率1 3bytes
Epm_met_Time2 EQU Epm_met_Time1+3 ;费率2 3 bytes
Epm_met_Time3 EQU Epm_met_Time2+3 ;费率3 3 bytes
Epm_met_Time4 EQU Epm_met_Time3+3 ;费率4 3 bytes
Epm_met_Time5 EQU Epm_met_Time4+3 ;费率5 3 bytes
;
Epm_met_Time6 EQU 90h ;费率6 3 bytes
Epm_met_Time7 EQU Epm_met_Time6+3 ;费率7 3 bytes
Epm_met_Time8 EQU Epm_met_Time7+3 ;费率8 3 bytes
Epm_met_Time9 EQU Epm_met_Time8+3 ;费率9 3 bytes
;
Epm_met_Time10 EQU 0A0h ;费率10 3 bytes
Epm_met_Time11 EQU Epm_met_Time10+3 ;费率11 3 bytes
Epm_met_Time12 EQU Epm_met_Time11+3 ;费率12 3 bytes
;
Epm_Rcod_year equ 0B0h ;实际的结算日期,年 1 byte
Epm_Rcod_month equ Epm_Rcod_year+1 ;月 1 byte.
Epm_ProgRam_date equ 0C0h ;3 byte 设时段的日期.
Epm_ProgRam_time equ Epm_ProgRam_date+3 ;3 byte 设时段的时间.
Epm_operater_code equ Epm_ProgRam_time+3 ;3 byte 设时段操作员代码.
Epm_Auto_date equ Epm_operater_code+3 ;3 byte 自动对时的日期.
Epm_Auto_time equ Epm_Auto_date+3 ;3 byte 自动对时的时间.
;---------------------------------------------------------------
;
;---------------------------------------------------------------
; EEPROM Blocks 1 Address (100h---1FFh)
;---------------------------------------------------------------
; EEPROM Blocks1 的备份
;---------------------------------------------------------------
;
;
;-------------------------------------------------------------
; EEPROM Blocks 2 Address (200h---2FFh)
;-------------------------------------------------------------
Record1_Tolt EQU 00h ;冻结1月总,4 bytes
Record1_Peak EQU Record1_Tolt+4 ;冻结1月峰,4 bytes
Record1_Flat EQU Record1_Peak+4 ;冻结1月平,4 bytes
Record1_Vale EQU Record1_Flat+4 ;冻结1月谷,4 bytes
Record2_Tolt EQU 10h ;冻结2月总,4 bytes
Record2_Peak EQU Record2_Tolt+4 ;冻结2月峰,4 bytes
Record2_Flat EQU Record2_Peak+4 ;冻结2月平,4 bytes
Record2_Vale EQU Record2_Flat+4 ;冻结2月谷,4 bytes
Record3_Tolt EQU 20h ;冻结3月总,4 bytes
Record3_Peak EQU Record3_Tolt+4 ;冻结3月峰,4 bytes
Record3_Flat EQU Record3_Peak+4 ;冻结3月平,4 bytes
Record3_Vale EQU Record3_Flat+4 ;冻结3月谷,4 bytes
Record4_Tolt EQU 30h ;冻结4月总,4 bytes
Record4_Peak EQU Record4_Tolt+4 ;冻结4月峰,4 bytes
Record4_Flat EQU Record4_Peak+4 ;冻结4月平,4 bytes
Record4_Vale EQU Record4_Flat+4 ;冻结4月谷,4 bytes
Record5_Tolt EQU 40h ;冻结5月总,4 bytes
Record5_Peak EQU Record5_Tolt+4 ;冻结5月峰,4 bytes
Record5_Flat EQU Record5_Peak+4 ;冻结5月平,4 bytes
Record5_Vale EQU Record5_Flat+4 ;冻结5月谷,4 bytes
Record6_Tolt EQU 50h ;冻结6月总,4 bytes
Record6_Peak EQU Record6_Tolt+4 ;冻结6月峰,4 bytes
Record6_Flat EQU Record6_Peak+4 ;冻结6月平,4 bytes
Record6_Vale EQU Record6_Flat+4 ;冻结6月谷,4 bytes
Record7_Tolt EQU 60h ;冻结7月总,4 bytes
Record7_Peak EQU Record7_Tolt+4 ;冻结7月峰,4 bytes
Record7_Flat EQU Record7_Peak+4 ;冻结7月平,4 bytes
Record7_Vale EQU Record7_Flat+4 ;冻结7月谷,4 bytes
Record8_Tolt EQU 70h ;冻结8月总,4 bytes
Record8_Peak EQU Record8_Tolt+4 ;冻结8月峰,4 bytes
Record8_Flat EQU Record8_Peak+4 ;冻结8月平,4 bytes
Record8_Vale EQU Record8_Flat+4 ;冻结8月谷,4 bytes
Record9_Tolt EQU 80h ;冻结9月总,4 bytes
Record9_Peak EQU Record9_Tolt+4 ;冻结9月峰,4 bytes
Record9_Flat EQU Record9_Peak+4 ;冻结9月平,4 bytes
Record9_Vale EQU Record9_Flat+4 ;冻结9月谷,4 bytes
Record10_Tolt EQU 090h ;冻结10月总,4 bytes
Record10_Peak EQU Record10_Tolt+4 ;冻结10月峰,4 bytes
Record10_Flat EQU Record10_Peak+4 ;冻结10月平,4 bytes
Record10_Vale EQU Record10_Flat+4 ;冻结10月谷,4 bytes
Record11_Tolt EQU 0A0h ;冻结11月总,4 bytes
Record11_Peak EQU Record11_Tolt+4 ;冻结11月峰,4 bytes
Record11_Flat EQU Record11_Peak+4 ;冻结11月平,4 bytes
Record11_Vale EQU Record11_Flat+4 ;冻结11月谷,4 bytes
Record12_Tolt EQU 0B0h ;冻结12月总,4 bytes
Record12_Peak EQU Record12_Tolt+4 ;冻结12月峰,4 bytes
Record12_Flat EQU Record12_Peak+4 ;冻结12月平,4 bytes
Record12_Vale EQU Record12_Flat+4 ;冻结12月谷,4 bytes
;----------冻结反向电量-------------------------------
Record1_Revers EQU 0C0h ;冻结1月反,4 bytes
Record2_Revers EQU Record1_Revers+4 ;冻结2月反,4 bytes
Record3_Revers EQU Record2_Revers+4 ;冻结3月反,4 bytes
Record4_Revers EQU Record3_Revers+4 ;冻结4月反,4 bytes
Record5_Revers EQU 0D0h ;冻结5月反,4 bytes
Record6_Revers EQU Record5_Revers+4 ;冻结6月反,4 bytes
Record7_Revers EQU Record6_Revers+4 ;冻结7月反,4 bytes
Record8_Revers EQU Record7_Revers+4 ;冻结8月反,4 bytes
Record9_Revers EQU 0E0h ;冻结9月反,4 bytes
Record10_Revers EQU Record9_Revers+4 ;冻结10月反,4 bytes
Record11_Revers EQU Record10_Revers+4 ;冻结11月反,4 bytes
Record12_Revers EQU Record11_Revers+4 ;冻结12月反,4 bytes
;-----------冻结电量校验字节-----------------------
Record1_Tst_Word EQU 0F0h ;冻结1月test word,1 bytes
Record2_Tst_Word EQU Record1_Tst_Word+1 ;冻结2月test word,1 bytes
Record3_Tst_Word EQU Record2_Tst_Word+1 ;冻结3月test word,1 bytes
Record4_Tst_Word EQU Record3_Tst_Word+1 ;冻结4月test word,1 bytes
Record5_Tst_Word EQU Record4_Tst_Word+1 ;冻结5月test word,1 bytes
Record6_Tst_Word EQU Record5_Tst_Word+1 ;冻结6月test word,1 bytes
Record7_Tst_Word EQU Record6_Tst_Word+1 ;冻结7月test word,1 bytes
Record8_Tst_Word EQU Record7_Tst_Word+1 ;冻结8月test word,1 bytes
Record9_Tst_Word EQU Record8_Tst_Word+1 ;冻结9月test word,1 bytes
Record10_Tst_Word EQU Record9_Tst_Word+1 ;冻结10月test word,1 bytes
Record11_Tst_Word EQU Record10_Tst_Word+1 ;冻结11月test word,1 bytes
Record12_Tst_Word EQU Record11_Tst_Word+1 ;冻结12月test word,1 bytes
;
;----------------------------------------------------------------
;
;----------------------------------------------------------------
; EEPROM Blocks 3 Address(300h---3FFh) bank of block2
;----------------------------------------------------------------
; This space is note used
; This space is note used
;----------------------------------------------------------------
;----------------------------------------------------------------
; EEPROM Blocks 4 Address (400h---4FFh)
; aSlave4 = h'0A8'
;----------------------------------------------------------------
; This space is note used
; This space is note used
; This space is note used
; This space is note used
;---------------------------------------------------------------
;---------------------------------------------------------------
; EEPROM Blocks 5 Address (500h---5FFh)
;---------------------------------------------------------------
; This space is note used
; This space is note used
; This space is note used
; This space is note used
; This space is note used
; This space is note used
;
;--------------------------------------------------------------
;-----------------------------------------------------------
; EEPROM Blocks 6 Address (600h---6FFh)
;-----------------------------------------------------------
; This space is note used
; This space is note used
; This space is note used
; This space is note used
; This space is note used
; This space is note used
;
;----------------------------------------------------------
;-----------------------------------------------------------
; EEPROM Blocks 7 Address (700h---7FFh)
;-----------------------------------------------------------
; This space is note used
; This space is note used
; This space is note used
; This space is note used
; This space is note used
; This space is note used
;
;------------------------------------------------------------
;-------------Eeprom Define End------------------
; Others Variable Define
;----------------------------------------------------------
; STATUS Bits
;----------------------------------------------------------
IRP EQU 7
RP1 EQU 6
RP0 EQU 5
TO EQU 4
PD EQU 3
Z EQU 2
DC EQU 1
C EQU 0
;
;----------------------------------------------
; Bits define
;----------------------------------------------
bit7 EQU 7
bit6 EQU 6
bit5 EQU 5
bit4 EQU 4
bit3 EQU 3
bit2 EQU 2
bit1 EQU 1
bit0 EQU 0
;------------------------------------------------------------------
; RA and RC PORT bits
;------------------------------------------------------------------
;aSCL EQU 5 ;RA5, serial clock;Lcd display port
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -