单片机课程设计电子钟实验文档格式.docx
- 文档编号:16327822
- 上传时间:2022-11-22
- 格式:DOCX
- 页数:32
- 大小:285.89KB
单片机课程设计电子钟实验文档格式.docx
《单片机课程设计电子钟实验文档格式.docx》由会员分享,可在线阅读,更多相关《单片机课程设计电子钟实验文档格式.docx(32页珍藏版)》请在冰豆网上搜索。
E4区-->
A3区
SDA-->
P1.0,数据线
SCL-->
P1.1,时钟
液晶12864J:
A1区-->
A3区
CS-->
CS1(0F000H),片选
RW-->
A0,读/写控制端
RS-->
A1,数据/指令控制端
CS1/2-->
A2,左右半屏使能端
*******************************************************
SECEQU30H;
保存秒数据,用于检测秒变化
TEMPEQU31H;
时间显示缓冲区
XSETEQU33H;
时间起始显示行设置
YSETEQU34H;
时间起始显示列设置
Time11EQU35H;
数据缓冲区
WR_COM_AD_LXDATA0F004H;
写左半屏指令地址
WR_COM_AD_RXDATA0F000H;
写右半屏指令地址
WR_DATA_AD_LXDATA0F006H;
写左半屏数据地址
WR_DATA_AD_RXDATA0F002H;
写右半屏数据地址
RD_BUSY_ADXDATA0F001H;
查忙地址
RD_DATA_ADXDATA0F003H;
读数据地址
XEQU0B8H;
起始显示行基址
YEQU040H;
起始显示列基址
FirstLineEQU0C0H;
起始显示行
SDABITP1.0;
数据传输口
SCLBITP1.1;
时钟
INTBITP3.2;
闹钟/定时中断输出
内部寄存器地址
CS1EQU00H;
控制/状态寄存器1
CS2EQU01H;
控制/状态寄存器2
SecondEQU02H;
秒寄存器
MinuteEQU03H;
分寄存器
HourEQU04H;
时寄存器
DayEQU05H;
天寄存器
WeekdayEQU06H;
周寄存器
MouthEQU07H;
月寄存器
YearEQU08H;
年寄存器
MinuteAEQU09H;
分闹铃寄存器
HourAEQU0AH;
时闹铃寄存器
DayAEQU0BH;
天闹铃寄存器
WeekdayAEQU0CH;
周闹铃寄存器
COEQU0DH;
时钟输出控制寄存器
TimerCtrlEQU0EH;
定时控制寄存器
TimerEQU0FH;
定时设置寄存器
PCF8563的片选地址:
001H
PCF8563_WRITEEQU0A2H;
写指令
PCF8563_READEQU0A3H;
读指令
ORG0
LCALLMainINIT;
主程序初始化
MAIN:
LCALLSec_Change;
检测秒变化,给出判断标志位CY,1-有变化
JNCMAIN
LCALLTime_Read;
读取时间
MOVSEC,TIME11;
LCALLTime_Display;
显示时间
JMPMAIN;
循环进行实验内容介绍与PCF8563测试
MainINIT:
LCALLLCD_INIT;
初始化液晶显示
LCALLPCF8563_INIT;
PCF8563初始化
LCALLBackGround;
显示背景,即显示不会变化的部分
读取时间,读取的时间数据存放在TIME中
CLRF0;
清秒变化标志
RET
显示时间背景
BackGround:
MOVDPTR,#PIC2;
显示"
2"
MOVA,#2
MOVB,#0
LCALLByteDisL;
显示1个字节子程序,左单屏
MOVDPTR,#PIC0;
0"
MOVB,#8
LCALLByteDisL
MOVDPTR,#BG1;
第1行背景"
-"
MOVA,#2;
起始显示行:
第2行
MOVB,#32;
起始显示列:
第16列
MOVDPTR,#BG1
MOVB,#56
MOVDPTR,#BG2;
第2行背景"
:
"
MOVA,#4
MOVB,#48
显示1个字节子程序,左半屏
MOVDPTR,#BG2
LCALLByteDisR;
显示1个字节子程序,右半屏
BG1:
;
DB000H,000H,000H,000H,000H,000H,000H,000H,001H,001H,001H,001H,001H,001H,001H,001H
BG2:
DB000H,000H,000H,0C0H,0C0H,000H,000H,000H,000H,000H,000H,030H,030H,000H,000H,000H
********************************
时间显示
********************************
检测秒变化,给出判断标志F0,1-秒有变化;
0-秒无变化
Sec_Change:
LCALLSec_Read;
读取秒
CJNEA,SEC,Sec_Change_1;
与前一次读取的秒比较,判断秒是否有变化
CLRC
Sec_Change_1:
SETBC
时间显示,时间数据在TIME缓冲区中
Time_Display:
MOVA,TIME11;
显示秒
ANLA,#0F0H
SWAPA
ACALLTEMPChange
MOVA,#4;
起始显示行在第4行(从第0行开始算)
MOVB,#16;
起始显示列在第16列(从第0列开始算)
LCALLByteDisR;
显示秒,右半屏
MOVA,TIME11
ANLA,#0FH
LCALLTEMPChange
MOVB,#24
LCALLByteDisR
MOVA,TIME11+1;
显示分
LCALLTEMPChange;
时间数据转换为图形显示数据
MOVB,#56;
起始显示列在第56列(从第0列开始算)
LCALLByteDisL;
显示分,左半屏
MOVA,TIME11+1
MOVA,TIME11+2;
显示小时
起始显示列在第32列(从第0列开始算)
显示小时,左半屏
MOVA,TIME11+2
MOVB,#40
显示日
MOVA,TIME11+3
起始显示行在第2行(从第0行开始算)
MOVB,#0;
起始显示列在第0列(从第0列开始算)
显示日,右半屏
显示周
MOVA,TIME11+4
LCALLWeekChange;
周数据转换为图形显示数据
MOVB,#40;
LCALLWeekDisplay;
显示周,右半屏
显示月
MOVA,TIME11+5
MOVB,#40;
起始显示列在第40列(从第0列开始算)
显示月,左半屏
显示年
MOVA,TIME11+6
显示年,左半屏
RET
时间数据转换为图形显示数据的起始地址
TEMPChange:
RLA
MOVB,A
MOVDPTR,#Time_Tab
MOVCA,@A+DPTR
XCHA,B
INCA
MOVDPL,A
MOVDPH,B
Time_Tab:
DWPIC0,PIC1,PIC2,PIC3,PIC4,PIC5,PIC6,PIC7,PIC8,PIC9
PIC0:
--文字:
0--
DB000H,0E0H,010H,008H,008H,010H,0E0H,000H,000H,00FH,010H,020H,020H,010H,00FH,000H
PIC1:
1--
DB000H,010H,010H,0F8H,000H,000H,000H,000H,000H,020H,020H,03FH,020H,020H,000H,000H
PIC2:
2--
DB000H,070H,008H,008H,008H,088H,070H,000H,000H,030H,028H,024H,022H,021H,030H,000H
PIC3:
3--
DB000H,030H,008H,088H,088H,048H,030H,000H,000H,018H,020H,020H,020H,011H,00EH,000H
PIC4:
4--
DB000H,000H,0C0H,020H,010H,0F8H,000H,000H,000H,007H,004H,024H,024H,03FH,024H,000H
PIC5:
5--
DB000H,0F8H,008H,088H,088H,008H,008H,000H,000H,019H,021H,020H,020H,011H,00EH,000H
PIC6:
6--
DB000H,0E0H,010H,088H,088H,018H,000H,000H,000H,00FH,011H,020H,020H,011H,00EH,000H
PIC7:
7--
DB000H,038H,008H,008H,0C8H,038H,008H,000H,000H,000H,000H,03FH,000H,000H,000H,000H
PIC8:
8--
DB000H,070H,088H,008H,008H,088H,070H,000H,000H,01CH,022H,021H,021H,022H,01CH,000H
PIC9:
9--
DB000H,0E0H,010H,008H,008H,010H,0E0H,000H,000H,000H,031H,022H,022H,011H,00FH,000H
周数据转换为图形显示数据的起始地址,存在TEMPDis中
WeekChange:
MOVDPTR,#Week_Tab
Week_Tab:
DWWeek0,Week1,Week2,Week3,Week4,Week5,Week6
Week0:
Sun"
DB000H,070H,088H,008H,008H,008H,038H,000H,000H,038H,020H,021H,021H,022H,01CH,000H
DB080H,080H,000H,000H,000H,080H,080H,000H,000H,01FH,020H,020H,020H,010H,03FH,020H
DB080H,080H,000H,080H,080H,080H,000H,000H,020H,03FH,021H,000H,000H,020H,03FH,020H
Week1:
Mon"
DB008H,0F8H,0F8H,000H,0F8H,0F8H,008H,000H,020H,03FH,000H,03FH,000H,03FH,020H,000H
DB000H,000H,080H,080H,080H,080H,000H,000H,000H,01FH,020H,020H,020H,020H,01FH,000H
Week2:
Tue"
DB018H,008H,008H,0F8H,008H,008H,018H,000H,000H,000H,020H,03FH,020H,000H,000H,000H
DB000H,000H,080H,080H,080H,080H,000H,000H,000H,01FH,022H,022H,022H,022H,013H,000H
Week3:
Wed"
DB0F8H,008H,000H,0F8H,000H,008H,0F8H,000H,003H,03CH,007H,000H,007H,03CH,003H,000H
DB000H,000H,000H,080H,080H,088H,0F8H,000H,000H,00EH,011H,020H,020H,010H,03FH,020H
Week4:
Thu"
DB008H,0F8H,000H,080H,080H,080H,000H,000H,020H,03FH,021H,000H,000H,020H,03FH,020H
Week5:
Fri"
DB008H,0F8H,088H,088H,0E8H,008H,010H,000H,020H,03FH,020H,000H,003H,000H,000H,000H
DB080H,080H,080H,000H,080H,080H,080H,000H,020H,020H,03FH,021H,020H,000H,001H,000H
DB000H,080H,098H,098H,000H,000H,000H,000H,000H,020H,020H,03FH,020H,020H,000H,000H
Week6:
Sat"
DB000H,000H,080H,080H,080H,080H,000H,000H,000H,019H,024H,022H,022H,022H,03FH,020H
DB000H,080H,080H,0E0H,080H,080H,000H,000H,000H,000H,000H,01FH,020H,020H,000H,000H
WeekDisplay:
PUSHACC;
A,B--X行,Y列序数
PUSHB
右半屏显示一个字节子程序
POPACC
ADDA,#8
PUSHACC
显示第2个字母
显示第3个字母
液晶初始化
LCD_INIT:
MOVA,#3EH;
初始化左半屏,关显示
LCALLWRComL;
写指令子程序
MOVA,#FirstLine;
设置起始显示行,第0行
LCALLWRComL
MOVA,#3EH;
初始化右半屏,关显示
LCALLWRComR;
LCALLWRComR
LCALLLCDClear;
清屏
MOVA,#3FH;
开显示
LCDClear:
;
清左半屏
MOVA,#0;
起始行,第0行
起始列,第0列
LCDClearL1:
PUSHACC
MOVR7,#64
LCALLSETXYL;
设置起始显示行列地址
LCDClearL2:
CLRA
LCALLWRDATAL
DJNZR7,LCDClearL2
CJNEA,#8,LCDClearL1;
共8行
;
清右半屏
LCDClearR1:
LCALLSETXYR;
LCDClearR2:
LCALLWRDATAR
DJNZR7,LCDClearR2
CJNEA,#8,LCDClearR1;
***************************************
显示字体,显示一个数据要占用X行两行位置
左半屏显示一个字节/字:
A-起始显示行序数X(0-7);
B-起始显示列序数Y(0-63);
DPTR-显示字数据首地址
ByteDisL:
MOVR7,#8;
显示8个字节数据,用于显示一个英文/符号
JMPDispL
WordDisL:
MOVR7,#16;
显示16字节数据,用于显示一个汉字
DispL:
PUSH07H
LCALLDisplayL;
显示上半行数据
POP07H;
DPTR指向下半部分字体数据区
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 单片机 课程设计 电子钟 实验
![提示](https://static.bdocx.com/images/bang_tan.gif)