📄 cap1p3.asm
字号:
cjne a,#6,prnt_mode2f6 ;"确认"
mov mrd,#0
prnt_mode2f50:
lcall LedBit_p2 ;Led位处理
mov 1ah,r2 ;暂存客户号
;显示"Prnt "等待打印
jmp prnt_mode2g
prnt_mode2f6:
cjne a,#2,prnt_mode2f7 ;"退出"
mov mrd,#0
jmp keyboard_p_ret
prnt_mode2f7:
cjne a,#4,prnt_mode2f5 ;"清除"
mov mrd,#0
jmp prnt_mode2f2
prnt_mode2g:
lcall readtime ;读取时间日期
lcall check_CZJLZZ ;判断称重记录单的存贮指针位置(use:08h,09h...)
jc prnt_mode2h ;称重记录已满,跳转
;称重记录未满
;将打印数据写打印缓冲区
mov 08h,16h
mov 09h,17h
mov 0ah,18h ;车号
mov 0bh,#0
mov 0ch,#0
mov 0dh,#0 ;皮重
mov 0eh,m_gross_0
mov 0fh,m_gross_1
mov 10h,m_gross_2 ;毛重
mov 11h,m_gross_0
mov 12h,m_gross_1
mov 13h,m_gross_2 ;净重
mov 14h,19h ;货号
mov 15h,1ah ;客户号
mov 16h,hour
mov 17h,minute
mov 18h,second ;时分秒
mov 19h,year
mov 1ah,month
mov 1bh,date ;年月日
jmp prnt_mode1i ;称重记录未满
prnt_mode2h:
mov 23h,16h
mov 24h,17h
mov 25h,18h ;保护车号
;mov 26h,10h
;mov 27h,11h
;mov 28h,12h ;保护皮重
;mov 29h,13h
;mov 32h,14h
;mov 53h,15h ;保护净重
mov 59h,19h ;保护货号
mov 77h,1ah ;保护客户号
lcall SavePush_CZJL ;将最早的一组记录挤出
mov 08h,23h
mov 09h,24h
mov 0ah,25h ;将车号写入打印缓冲区
mov 0bh,#0
mov 0ch,#0
mov 0dh,#0 ;将皮重写入打印缓冲区
mov 0eh,m_gross_0
mov 0fh,m_gross_1
mov 10h,m_gross_2 ;将毛重写入打印缓冲区
mov 11h,m_gross_0
mov 12h,m_gross_1
mov 13h,m_gross_2 ;将净重写入打印缓冲区
mov 14h,59h ;将货号写入打印缓冲区
mov 15h,77h ;将客户号写入打印缓冲区
mov 16h,hour
mov 17h,minute
mov 18h,second ;时分秒
mov 19h,year
mov 1ah,month
mov 1bh,date ;年月日
jmp prnt_mode1i
;------------------------------------------------
prnt_mode3: ;打印模式3:两次贮存打印称重单
lcall dis_flashH
prnt_mode3e1:
mov a,mrd
jz prnt_mode3e1
cjne a,#6,prnt_mode3e2
mov mrd,#0
mov a,disp_buf
clr acc.6
mov disp_buf,a
jmp prnt_mode3e50
prnt_mode3e2:
lcall dis_flashH0
mov r7,#2
prnt_mode3e3:
mov a,mrd
jz prnt_mode3e3
lcall key_handle
jnb f_key_num,prnt_mode3e5
lcall dis_forward_H
djnz r7,prnt_mode3e3 ;输入两位货号
prnt_mode3e5:
mov a,mrd
jz prnt_mode3e5
cjne a,#6,prnt_mode3e6 ;"确认"
mov mrd,#0
prnt_mode3e50:
lcall LedBit_p2 ;Led位处理
mov 19h,r2 ;暂存货号
jmp prnt_mode3f
prnt_mode3e6:
cjne a,#2,prnt_mode3e7 ;"退出"
mov mrd,#0
jmp keyboard_p_ret
prnt_mode3e7:
cjne a,#4,prnt_mode3e5 ;"清除"
mov mrd,#0
jmp prnt_mode3e2
prnt_mode3f:
lcall dis_flashCLT
prnt_mode3f1:
mov a,mrd
jz prnt_mode3f1
cjne a,#6,prnt_mode3f2
mov mrd,#0
mov a,disp_buf
clr acc.6
mov disp_buf,a
jmp prnt_mode3f50
prnt_mode3f2:
lcall dis_flashCLT0
mov r7,#2
prnt_mode3f3:
mov a,mrd
jz prnt_mode3f3
lcall key_handle
jnb f_key_num,prnt_mode3f5
lcall dis_forward_CLT
djnz r7,prnt_mode3f3 ;输入两位客户号
prnt_mode3f5:
mov a,mrd
jz prnt_mode3f5
cjne a,#6,prnt_mode3f6 ;"确认"
mov mrd,#0
prnt_mode3f50:
lcall LedBit_p2 ;Led位处理
mov 1ah,r2 ;暂存客户号
;查找该车号记录是否存在
;---------------------------------
mov a,m_tare_count
jb acc.0,prnt_mode5 ;若此时处于去皮状态,进入打印模式5
jmp check_CZJL_integrity
prnt_mode5:
mov addr_h,#00h
mov addr_l,#26h
mov r0,#1ch
mov r2,#2
lcall fm_read_block ;读取是否使用填充打印格式,扣率值
mov a,1ch
jnz fill_prnt ;进入填充打印格式
jmp prnt_mode5g ;转>>>打印模式5:已知皮重状态下的打印
fill_prnt:
jmp prnt_mode6g ;转>>>打印模式6:填充打印
;------------------------------
prnt_mode3f6:
cjne a,#2,prnt_mode3f7 ;"退出"
mov mrd,#0
jmp keyboard_p_ret
prnt_mode3f7:
cjne a,#4,prnt_mode3f5 ;"清除"
mov mrd,#0
jmp prnt_mode3f2
check_CZJL_integrity:
mov dph,#06h
mov dpl,#57h ;从第一个称重记录的指针处开始查找
mov r7,#164
mov r6,#2
check_CZJL_integrity0:
mov addr_h,dph
mov addr_l,dpl
mov r0,#08h
mov r2,#9
lcall fm_read_block ;读车号,皮重,毛重
mov a,08h
cjne a,16h,check_CZJL_integrity1
mov a,09h
cjne a,17h,check_CZJL_integrity1
mov a,0ah
cjne a,18h,check_CZJL_integrity1 ;判断该车号记录不存在,继续查找
;判断该车号记录已存在,继续判断该车的皮重是否为0?
mov a,0bh
jnz check_CZJL_integrity1
mov a,0ch
jnz check_CZJL_integrity1
mov a,0dh
jnz check_CZJL_integrity1 ;该车号的皮重不为0,说明该车号的记录已经完整,继续查找
;该车号的皮重已为0,说明该车号的记录还不完整,转>>>填补该记录
jmp check_CZJL_integrity4 ;转>>>填补该记录
check_CZJL_integrity1:
lcall add_addr20 ;地址递加20
djnz r7,check_CZJL_integrity0
mov r7,#164
djnz r6,check_CZJL_integrity0
;该车号的称重记录不存在,需开辟存贮区贮存新记录
lcall check_CZJLZZ ;判断称重记录存贮指针的位置
jc check_CZJL_integrity5 ;称重记录已满
;称重记录未满
mov 08h,16h
mov 09h,17h
mov 0ah,18h ;车号写进存贮缓冲区
mov 0bh,#0
mov 0ch,#0
mov 0dh,#0 ;皮重写进存贮缓冲区
mov 0eh,m_gross_0
mov 0fh,m_gross_1
mov 10h,m_gross_2 ;毛重写进存贮缓冲区
mov 11h,#0
mov 12h,#0
mov 13h,#0 ;净重
mov 14h,19h ;货号
mov 15h,1ah ;客户号
jmp check_CZJL_integrity6 ;转,贮存
check_CZJL_integrity5:
mov 23h,16h
mov 24h,17h
mov 25h,18h ;保护车号
mov 59h,19h ;保护货号
mov 77h,1ah ;保护客户号
lcall SavePush_CZJL ;将最早的一组记录挤出
mov 08h,23h
mov 09h,24h
mov 0ah,25h ;车号写进存贮缓冲区
mov 0bh,#0
mov 0ch,#0
mov 0dh,#0 ;皮重写进存贮缓冲区
mov 0eh,m_gross_0
mov 0fh,m_gross_1
mov 10h,m_gross_2 ;毛重写进存贮缓冲区
mov 11h,#0
mov 12h,#0
mov 13h,#0 ;净重
mov 14h,59h ;将货号写入打印缓冲区
mov 15h,77h ;将客户号写入打印缓冲区
check_CZJL_integrity6:
mov r0,#08h
mov r2,#14
mov addr_h,dph
mov addr_l,dpl
lcall write_block ;写存贮器
;显示"LoAd "约1.5秒,以提醒操作者该记录还不完整
mov 1ch,dph
mov 1dh,dpl
mov r0,#1ch
mov r2,#2
mov addr_h,#00h
mov addr_l,#57h
lcall write_block ;保存该打印记录的存贮指针位置
lcall add_addr20 ;地址递加20
mov 08h,dph
mov 09h,dpl
mov r0,#08h
mov r2,#2
mov addr_h,#06h
mov addr_l,#55h
lcall write_block ;称重记录指针下移一步(空记录处)
mov disp_buf, #1fh
mov disp_buf+1,#1fh
mov disp_buf+2,#0dh
mov disp_buf+3,#0ah
mov disp_buf+4,#15h
mov disp_buf+5,#14h
lcall disp_sub ;显示"LoAd "
lcall delay500ms
lcall delay500ms
lcall delay500ms
jmp keyboard_p_ret
check_CZJL_integrity4: ;两次存贮方式,已构成一个完整的记录
lcall readtime ;读取时间日期
clr a
mov r4,a
mov r0,a
mov r5,m_gross_0
mov r6,m_gross_1
mov r7,m_gross_2 ;当前称量得到的毛重m_gross_0,m_gross_1,m_gross_2
mov r1,0eh
mov r2,0fh
mov r3,10h ;不完整称重中存贮的毛重
lcall L02A8H_SUBB ;判断两个毛重大小:大的是毛重,小的是皮重
mov a,r4
jz check_CZJL_integrity2
lcall L_abs ;求绝对值
mov 0bh,m_gross_0
mov 0ch,m_gross_1
mov 0dh,m_gross_2 ;m_gross_0,m_gross_1,m_gross_2小,是皮重;0eh0fh10h大,是毛重
jmp check_CZJL_integrity3
check_CZJL_integrity2: ;m_gross_0,m_gross_1,m_gross_2大,是毛重;0eh0fh10h小,是皮重
mov 0bh,0eh
mov 0ch,0fh
mov 0dh,10h ;皮重
mov 0eh,m_gross_0
mov 0fh,m_gross_1
mov 10h,m_gross_2 ;毛重
check_CZJL_integrity3:
mov 11h,r5
mov 12h,r6
mov 13h,r7 ;净重
lcall net_integrity ;判断净重是否合法
jnc mode3_continue
jmp mode5_err
mode3_continue:
mov 08h,16h
mov 09h,17h
mov 0ah,18h ;车号
mov 14h,19h ;货号
mov 15h,1ah ;客户号
mov 16h,hour
mov 17h,minute
mov 18h,second ;时分秒
mov 19h,year
mov 1ah,month
mov 1bh,date ;年月日
jmp prnt_mode1i
;--------------------------------------------
mode5_err:
mov disp_buf, #01h
mov disp_buf+1,#01h
mov disp_buf+2,#1fh
mov disp_buf+3,#18h
mov disp_buf+4,#18h
mov disp_buf+5,#0eh
lcall disp_sub ;显示"err 11",零或负称量不能贮存
clr p_buzz
lcall delay500ms
setb p_buzz
lcall delay500ms
lcall delay500ms
jmp keyboard_p_ret
;---------------------------------
net_integrity: ;判断净重是否合法:净重>0,合法;净重<=0,不合法
mov a,11h
jb acc.7,net_integrityNo
cjne a,#0,net_integrityYes
mov a,12h
cjne a,#0,net_integrityYes
mov a,13h
cjne a,#0,net_integrityYes
net_integrityNo:
setb c ;净重不合法
jmp net_integrity_ret
net_integrityYes:
clr c ;净重合法
net_integrity_ret:
ret
;-----------------------------------
prnt_mode5g: ;打印模式5:已知皮重状态下的打印
mov r4,#0
mov r5,m_gross_0
mov r6,m_gross_1
mov r7,m_gross_2
mov r0,#0
mov r1,m_tare_0
mov r2,m_tare_1
mov r3,m_tare_2
lcall L02A8H_SUBB
mov a,r4
jnz mode5_err_0
mov a,r5
jnz mode5_err_0
mov a,r6
jnz mode5_err_0
mov a,r7
jnz mode5_err_0
jmp mode5_err ;零称量不能贮存
mode5_err_0:
mov a,r4
jb acc.0,mode5_err ;负称量不能贮存
mov 11h,r5
mov 12h,r6
mov 13h,r7 ;净重
lcall readtime ;读取时间日期
lcall check_CZJLZZ ;判断称重记录单的存贮指针位置(use:08h,09h...)
jc prnt_mode5h ;称重记录已满,跳转
;称重记录未满
;将打印数据写打印缓冲区
mov 08h,16h
mov 09h,17h
mov 0ah,18h ;车号
mov 0bh,m_tare_0
mov 0ch,m_tare_1
mov 0dh,m_tare_2 ;皮重
mov 0eh,m_gross_0
mov 0fh,m_gross_1
mov 10h,m_gross_2 ;将毛重写入打印缓冲区
mov a,#0
mov r0,a
mov r4,a
mov r5,m_gross_0
mov r6,m_gross_1
mov r7,m_gross_2 ;皮重
mov r1,m_tare_0
mov r2,m_tare_1
mov r3,m_tare_2 ;毛重
lcall L02A8H_SUBB ;毛重-皮重=净重
mov 11h,r5
mov 12h,r6
mov 13h,r7 ;将净重写入打印缓冲区
mov 14h,19h ;货号
mov 15h,1ah ;客户号
mov 16h,hour
mov 17h,minute
mov 18h,second ;时分秒
mov 19h,year
mov 1ah,month
mov 1bh,date ;年月日
jmp prnt_mode1i ;称重记录未满
prnt_mode5h:
mov 23h,16h
mov 24h,17h
mov 25h,18h ;保护车号
;mov 26h,10h
;mov 27h,11h
;mov 28h,12h ;保护皮重
;mov 29h,13h
;mov 32h,14h
;mov 53h,15h ;保护净重
mov 26h,19h ;保护货号
mov 27h,1ah ;保护客户号
lcall SavePush_CZJL ;将最早的一组记录挤出
mov 08h,23h
mov 09h,24h
mov 0ah,25h ;将车号写入打印缓冲区
mov 0bh,m_tare_0
mov 0ch,m_tare_1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -