📄 pcf8563.s
字号:
.module pcf8563.c
.area text(rom, con, rel)
.dbfile D:\mega16\drive\pcf8563.c
.dbfunc e PCF8563Write _PCF8563Write fc
; NByte -> R22
; Data -> R20,R21
.even
_PCF8563Write::
xcall push_gset2
movw R20,R16
sbiw R28,1
.dbline -1
.dbline 49
; /*********************************************************************************************************
; ** Small RTOS(51)
; ** The Real-Time Kernel(For Keil c51)
; **
; ** (c) Copyright 2002-2002, chenmingji
; ** All Rights Reserved
; **
; ** V1.11.0
; **
; **
; **--------------文件信息--------------------------------------------------------------------------------
; **文 件 名: Pcf8563.h
; **创 建 人: 陈明计
; **最后修改日期: 2002年12月9日
; **描 述: Small RTOS Pcf8563驱动程序源文件,也可以在不使用
; ** Small RTOS的情况下使用
; **--------------历史版本信息----------------------------------------------------------------------------
; ** 创建人: 陈明计
; ** 版 本: V1.00
; ** 日 期: 2002年12月9日
; ** 描 述: 原始版本
; **
; **------------------------------------------------------------------------------------------------------
; ** 修改人:
; ** 版 本:
; ** 日 期:
; ** 描 述:
; **
; **--------------当前版本修订------------------------------------------------------------------------------
; ** 修改人:
; ** 日 期:
; ** 描 述:
; **
; **------------------------------------------------------------------------------------------------------
; ********************************************************************************************************/
; #include "config.h"
;
; /*********************************************************************************************************
; ** 函数名称: PCF8563Write
; ** 功能描述: 设置PCF8563寄存器(仅允许一个任务可以调用)
; ** 输 入: Data[0]:设置寄存器数目
; ** Data[1]:设置寄存器的起始的地址
; ** Data[2]~Data[Data[1] + 1]:设置数据
; ** 输 出: 无
; ** 全局变量: 无
; ** 调用模块: 无
; ********************************************************************************************************/
; unsigned char PCF8563Write(unsigned char *Data)
; {
.dbline 52
; unsigned char NByte;
;
; NByte = *Data++;
movw R30,R20
ld R22,Z+
movw R20,R30
.dbline 53
; NByte++;
inc R22
.dbline 55
; // return (IIC_write(PCF8563Addr,Data,NByte));
; return (IICWrite(PCF8563Addr,Data,NByte));
std y+0,R22
movw R18,R30
ldi R16,162
xcall _IICWrite
.dbline -2
L1:
adiw R28,1
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r NByte 22 c
.dbsym r Data 20 pc
.dbend
.dbfunc e PCF8563Read _PCF8563Read fc
; NByte -> R22
; Data -> R20,R21
.even
_PCF8563Read::
xcall push_gset2
movw R20,R16
sbiw R28,1
.dbline -1
.dbline 68
; }
;
; /*********************************************************************************************************
; ** 函数名称: PCF8563Read
; ** 功能描述: 读取PCF8563寄存器(仅允许一个任务可以调用)
; ** 输 入: Data[0]:读取寄存器数目
; ** Data[1]:读取寄存器的起始的地址
; ** 输 出: Data:读取的数据
; ** 全局变量: 无
; ** 调用模块: 无
; ********************************************************************************************************/
; unsigned char PCF8563Read(unsigned char *Data)
; {
.dbline 71
; unsigned char NByte;
;
; NByte = *Data++;
movw R30,R20
ld R22,Z+
movw R20,R30
.dbline 73
; // if(IIC_write(PCF8563Addr,Data,1) == FALSE) return FALSE;
; if(IICWrite(PCF8563Addr,Data,1) == FALSE) return FALSE;
ldi R24,1
std y+0,R24
movw R18,R30
ldi R16,162
xcall _IICWrite
cpi R16,2
brne L3
.dbline 73
ldi R16,2
xjmp L2
L3:
.dbline 75
; // if(IIC_read(PCF8563Addr,Data - 1,NByte) == FALSE) return FALSE;
; if(IICRead(Data + 3,PCF8563Addr,NByte) == FALSE) return FALSE;
std y+0,R22
ldi R18,162
movw R16,R20
subi R16,253 ; offset = 3
sbci R17,255
xcall _IICRead
cpi R16,2
brne L5
.dbline 75
ldi R16,2
xjmp L2
L5:
.dbline 76
; return TRUE ;
ldi R16,1
.dbline -2
L2:
adiw R28,1
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r NByte 22 c
.dbsym r Data 20 pc
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -