📄 lprtpos.c
字号:
wwr(0x5e00+x1,0);
wwr(0x6000+x1,0);
wwr(0x6200+x1,0);
}
for (x1=8;x1<15;x1++)
{
wwr(0x5400+x1,time[x1-8]);
}
delay(3);
for (x1=0;x1<7;x1++)
{
wwr(0x5600+x1,time[x1]);
delay(1);
}
dday=time[3];
}
else {
for (x1=0;x1<8;x1++)
{
zdmoney[x1]=wrd(0x5400+x1);
umoney1[x1]=wrd(0x5800+x1);
umoney2[x1]=wrd(0x5a00+x1);
umoney3[x1]=wrd(0x5c00+x1);
umoney4[x1]=wrd(0x5e00+x1);
umoney5[x1]=wrd(0x6000+x1);
umoney6[x1]=wrd(0x6200+x1);
}
}
}
/*day print clear?*/
/*模拟串口相关子程序11.0592MHZ*/
void IntTimer0() interrupt 1
{
F_TM=1;
}
/*发送一个字符*/
void PSendChar(UINT8 inch)
{
#ifdef MODE_QUICK
ACC=inch;
F_TM=0;
BT_SND=0; //start bit
TIMER0_ENABLE; /*启动*/
while(!F_TM);
BT_SND=ACC0; /*先送出低位*/
F_TM=0;
while(!F_TM);
BT_SND=ACC1;
F_TM=0;
while(!F_TM);
BT_SND=ACC2;
F_TM=0;
while(!F_TM);
BT_SND=ACC3;
F_TM=0;
while(!F_TM);
BT_SND=ACC4;
F_TM=0;
while(!F_TM);
BT_SND=ACC5;
F_TM=0;
while(!F_TM);
BT_SND=ACC6;
F_TM=0;
while(!F_TM);
BT_SND=ACC7;
F_TM=0;
while(!F_TM);
BT_SND=1;
F_TM=0;
while(!F_TM);
TIMER0_DISABLE; /*停止timer*/
#else
UINT8 ii;
ii=0;
F_TM=0;
BT_SND=0; /*start bit*/
TIMER0_ENABLE; /*启动*/
while(!F_TM);
while(ii<8)
{
if(inch&1)
{
BT_SND=1;
}
else
{
BT_SND=0;
}
F_TM=0;
while(!F_TM);
ii++;
inch>>=1;
}
BT_SND=1;
F_TM=0;
while(!F_TM);
#endif
TIMER0_DISABLE; /*停止timer*/
}
/*接收一个字符*/
UINT8 PGetChar()
{
#ifdef MODE_QUICK
TIMER0_ENABLE;
F_TM=0;
while(!F_TM); /*等过起始位*/
ACC0=BT_REC;
TL0=TH0;
F_TM=0;
while(!F_TM);
ACC1=BT_REC;
F_TM=0;
while(!F_TM);
ACC2=BT_REC;
F_TM=0;
while(!F_TM);
ACC3=BT_REC;
F_TM=0;
while(!F_TM);
ACC4=BT_REC;
F_TM=0;
while(!F_TM);
ACC5=BT_REC;
F_TM=0;
while(!F_TM);
ACC6=BT_REC;
F_TM=0;
while(!F_TM);
ACC7=BT_REC;
F_TM=0;
while(!F_TM)
{
if(BT_REC)
{
break;
}
}
TIMER0_DISABLE; /*停止timer*/
return ACC;
#else
UINT8 rch,ii;
TIMER0_ENABLE;
F_TM=0;
ii=0;
rch=0;
while(!F_TM); /*等过起始位*/
while(ii<8)
{
rch>>=1;
if(BT_REC)
{
rch|=0x80;
}
ii++;
F_TM=0;
while(!F_TM);
}
F_TM=0;
while(!F_TM)
{
if(BT_REC)
{
break;
}
}
TIMER0_DISABLE; /*停止timer*/
return rch;
#endif
}
/*检查是不是有起始位*/
bit StartBitOn()
{
return (BT_REC==0);
}
/*模拟串口相关子程序11.0592MHZ*/
/*小票打印相关子程序*/
void thanks(void)
{
UINT8 x1,x2;
PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
PSendChar(0x1B);PSendChar(0x66);PSendChar(0);PSendChar(0x09);/*2个空格*/
PSendChar(0xb7);PSendChar(0xc0);/*防*/
PSendChar(0xce);PSendChar(0xb1);/*伪*/
PSendChar(0xb1);PSendChar(0xea);/*标*/
PSendChar(0xbc);PSendChar(0xc7);/*记*/
PSendChar(0xa3);PSendChar(0xba);/*:*/
PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
PSendChar(0x1b);PSendChar(0x36);
/*0、1、2、3、4、5、6、7、8、9、.等字符*/
PSendChar(0x20);
x1=((time[6]^cred1)>>4); if (x1>9) {x1=15-x1+0x30;} else {x1=x1+0x30;}
x2=(0x0f&(time[6]^cred1));if (x2>9) {x2=15-x2+0x30;} else {x2=x2+0x30;}
PSendChar(x1);PSendChar(x2);
x1=((time[5]^cred1)>>4); if (x1>9) {x1=15-x1+0x30;} else {x1=x1+0x30;}
x2=(0x0f&(time[5]^cred1)); if (x2>9) {x2=15-x2+0x30;} else {x2=x2+0x30;}
PSendChar(x1);PSendChar(x2);
x1=((time[3]^cred2)>>4); if (x1>9) {x1=15-x1+0x30;} else {x1=x1+0x30;}
x2=(0x0f&(time[3]^cred2));if (x2>9) {x2=15-x2+0x30;} else {x2=x2+0x30;}
PSendChar(x1);PSendChar(x2);
PSendChar(0x0D);/*换行 */
PSendChar(0x1B);PSendChar(0x66);PSendChar(0);PSendChar(0x04
);/*2个空格*/
PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
PSendChar(0xb8);PSendChar(0xd0);/*感*/
PSendChar(0xd0);PSendChar(0xbb);/*谢*/
PSendChar(0xbb);PSendChar(0xdd);/*惠*/
PSendChar(0xb9);PSendChar(0xcb);/*顾*/
PSendChar(0xa3);PSendChar(0xac);/*,*/
PSendChar(0xc7);PSendChar(0xeb);/*请*/
PSendChar(0xb1);PSendChar(0xa3);/*保*/
PSendChar(0xb4);PSendChar(0xe6);/*存*/
PSendChar(0xba);PSendChar(0xc3);/*好*/
PSendChar(0xd0);PSendChar(0xa1);/*小*/
PSendChar(0xc6);PSendChar(0xb1);/*票*/
PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
PSendChar(0x0D);/*换行 */
}
/*当日当次打印*/
void prtd(UINT8 money1,money2,money3,money4,money5)
{
UINT8 x1,x2;
prtinit();
while(busy);
PSendChar(0x1B);PSendChar(0x40);/*打印机初始化*/
PSendChar(0x1B);PSendChar(0x31);PSendChar(0x06);/*3点行间距*/
PSendChar(0x1B);PSendChar(0x66);PSendChar(1);PSendChar(0x02);/*2个空行*/
PSendChar(0x1B);PSendChar(0x6C);PSendChar(0); /*设置左限*/
PSendChar(0x1B);PSendChar(0x51);PSendChar(0);/*设置右限*/
PSendChar(0x1B);PSendChar(0x70);PSendChar(1);/*字符间距为2*/
PSendChar(0x0D);/*换行 */
thanks();
PSendChar(0x0D);//换行
PSendChar(0x1b);PSendChar(0x36);/*字符集1*/
for (x1=0;x1<14;x1++)
{
PSendChar(0x3d);PSendChar(0x20);/*=*/
}
PSendChar(0x3d);
PSendChar(0x0D);//换行
PSendChar(0x1B);PSendChar(0x66);PSendChar(0);PSendChar(0x06);/*2个空格*/
PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
PSendChar(0xcf);PSendChar(0xd6);/*现*/
PSendChar(0xbd);PSendChar(0xf0);/*金*/
PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
PSendChar(0x1b);PSendChar(0x36);/*字符集1*/
for (x1=0;x1<7;x1++)
{
PSendChar(0x20);
}
PSendChar(0x20+money1);
PSendChar(0x20+money2);PSendChar(0x20+money3);
PSendChar(0x2e);PSendChar(0x30+money4);
PSendChar(0x30+money5);
PSendChar(0x0D);//换行
PSendChar(0x1b);PSendChar(0x36);/*字符集1*/
for (x1=0;x1<14;x1++)
{
PSendChar(0x2d);PSendChar(0x20);/*-*/
}
PSendChar(0x2d);
PSendChar(0x0D);//换行
PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
PSendChar(0xb2);PSendChar(0xbf);/*部*/
PSendChar(0xc0);PSendChar(0xe0);/*类*/
PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
PSendChar(0x1b);PSendChar(0x36);/*字符集1*/
PSendChar(0x30);PSendChar(0x30+unit);
for (x1=0;x1<14;x1++)
{
PSendChar(0x20);
}
PSendChar(0x20+money1);
PSendChar(0x20+money2);PSendChar(0x20+money3);
PSendChar(0x2e);PSendChar(0x30+money4);
PSendChar(0x30+money5);
PSendChar(0x0D);//换行
PSendChar(0x1b);PSendChar(0x36);/*字符集1*/
for (x1=0;x1<14;x1++)
{
PSendChar(0x2d);PSendChar(0x20);/*-*/
}
PSendChar(0x2d);
PSendChar(0x0D);//换行
PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
PSendChar(0xc8);PSendChar(0xd5);/*日*/
PSendChar(0xc6);PSendChar(0xda);/*期*/
// PSendChar(0xa3);PSendChar(0xba);/*:*/
PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
/*打印日期数字*/
PSendChar(0x1B);PSendChar(0x36); PSendChar(0x3a);
/*0、1、2、3、4、5、6、7、8、9、.等字符*/
PSendChar(0x32);PSendChar(0x30);
x1=((time[6]>>4)+0x30);x2=((0x0f&time[6])+0x30);
PSendChar(x1);PSendChar(x2);
PSendChar(0x2d);
x1=((time[5]>>4)+0x30);x2=((0x0f&time[5])+0x30);
PSendChar(x1);PSendChar(x2);
PSendChar(0x2d);
x1=((time[3]>>4)+0x30);x2=((0x0f&time[3])+0x30);
PSendChar(x1);PSendChar(x2);
PSendChar(0x20);
PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
PSendChar(0xca);PSendChar(0xb1);/*时*/
PSendChar(0xbc);PSendChar(0xe4);/*间*/
PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
PSendChar(0x1B);PSendChar(0x36); PSendChar(0x3a);
x1=((time[2]/16)+0x30);x2=((time[2]%16)+0x30);
PSendChar(x1);PSendChar(x2);
PSendChar(0x3a);
x1=((time[1]/16)+0x30);x2=((time[1]%16)+0x30);
PSendChar(x1);PSendChar(x2);
PSendChar(0x3a);
x1=((time[0]/16)+0x30);x2=((time[0]%16)+0x30);
PSendChar(x1);PSendChar(x2);
PSendChar(0x0D);//换行
PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
PSendChar(0xca);PSendChar(0xd5);/*收*/
PSendChar(0xbe);PSendChar(0xdd);/*据*/
PSendChar(0xba);PSendChar(0xc5);/*号*/
//PSendChar(0xa3);PSendChar(0xba);/*:*/
PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
PSendChar(0x1b);PSendChar(0x36);/*字符集1*/
PSendChar(0x3a);
for (x1=0;x1<4;x1++)
{
PSendChar(0x30);/*0*/
}
PSendChar(0x23);/*#*/
x1=((cred2/10)+0x30);x2=((cred2%10)+0x30);
PSendChar(x1);PSendChar(x2);
x1=((cred1/10)+0x30);x2=((cred1%10)+0x30);
PSendChar(x1);PSendChar(x2);
PSendChar(0x20);
PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
PSendChar(0xca);PSendChar(0xd5);/*收*/
PSendChar(0xbf);PSendChar(0xee);/*款*/
// PSendChar(0xa3);PSendChar(0xba);/*:*/
PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
PSendChar(0x1b);PSendChar(0x36);/*字符集1*/
PSendChar(0x3a);
PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
PSendChar(0xca);PSendChar(0xd5);/*收*/
PSendChar(0xbf);PSendChar(0xee);/*款*/
PSendChar(0xd4);PSendChar(0xb1);/*员*/
PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
PSendChar(0x1b);PSendChar(0x36);/*字符集1*/
PSendChar(0x30);PSendChar(0x31);
PSendChar(0x0D);//换行
PSendChar(0x1b);PSendChar(0x36);/*字符集1*/
for (x1=0;x1<14;x1++)
{
PSendChar(0x3d);PSendChar(0x20);/*=*/
}
PSendChar(0x3d);
PSendChar(0x0D);//换行
PSendChar(0x1B);PSendChar(0x66);PSendChar(0);PSendChar(0x0a);/*2个空格*/
PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
PSendChar(0xca);PSendChar(0xd5);/*收*/
PSendChar(0xd2);PSendChar(0xf8);/*银*/
PSendChar(0xc6);PSendChar(0xbe);/*凭*/
PSendChar(0xbe);PSendChar(0xdd);/*据*/
PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
PSendChar(0x0D);//换行
/*设置大字体*/
// PSendChar();
PSendChar(0x1B);PSendChar(0x55);PSendChar(1);/*汉字放大*/
PSendChar(0x1B);PSendChar(0x56);PSendChar(2);/*汉字放大*/
//
PSendChar(0x1B);PSendChar(0x66);PSendChar(0);PSendChar(0x06);/*2个空格*/
// PSendChar(0x1C);PSendChar(0x0e);/*汉字放大*/
// PSendChar(0x1B);PSendChar(0x55);PSendChar(0);PSendChar(0x02);/*2个空格*/
PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
// PSendChar(0x1C);PSendChar(0x57);PSendChar(2);/*汉字放大*/
PSendChar(0xd2);PSendChar(0xf8);/*银*/
PSendChar(0xba);PSendChar(0xd3);/*河*/
PSendChar(0xbf);PSendChar(0xa8);/*卡*/
PSendChar(0xcf);PSendChar(0xb5);/*系*/
PSendChar(0xc1);PSendChar(0xd0);/*列*/
PSendChar(0xca);PSendChar(0xd5);/*收*/
PSendChar(0xd2);PSendChar(0xf8);/*银*/
PSendChar(0xbb);PSendChar(0xfa);/*机*/
// PSendChar(0x1C);PSendChar(0x57);PSendChar(1);/*汉字放大*/
PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
// PSendChar(0x1C);PSendChar(0x57);PSendChar(1);/*汉字放大*/
// PSendChar(0x1C);PSendChar(0x14);/*汉字放大*/
PSendChar(0x0D);//换行
PSendChar(0x1B);PSendChar(0x66);PSendChar(1);PSendChar(0x05);/*5空行*/
erase(0x6400);
delay(3);
wwr(0x6400,cred1);
wwr(0x6401,cred2);
wwr(0x6402,time[3]);
}
void sprtshow(UINT8 bai,shi,ge,pshi,pge)
{
p37=0;P2=P2&0xe0;vp15=0;P0=0;p37=1;vp15=1;P2=0xff;
p37=0;P2=P2&0xe0;vp15=0;P0=shi;vp20=1;p37=1;delay(1);
p37=0;P2=P2&0xe0;vp15=0;P0=0;p37=1;vp15=1;P2=0xff;
p37=0;P2=P2&0xe0;vp15=0;P0=ge;vp21=1;p37=1;delay(1);
p37=0;P2=P2&0xe0;vp15=0;P0=0;p37=1;vp15=1;P2=0xff;
p37=0;P2=P2&0xe0;vp15=0;P0=pshi;vp22=1;p37=1;delay(1);
p37=0;P2=P2&0xe0;vp15=0;P0=0;p37=1;vp15=1;P2=0xff;
p37=0;P2=P2&0xe0;vp15=0;P0=pge;vp23=1;p37=1;delay(1);
p37=0;P2=P2&0xe0;vp15=0;P0=0;p37=1;vp15=1;P2=0xff;
p37=0;P2=P2&0xe0;vp15=0;P0=bai;vp15=1;p37=1;delay(1);
p37=0;P2=P2&0xe0;vp15=0;P0=0;p37=1;vp15=1;P2=0xff;
p37=0;P2=P2&0xe0;vp15=0;P0=led[unit];vp24=1;p37=1;delay(1);
}
/*日累计加法*/
void dadd(UINT8 money1,money2,money3,money4,money5)
{UINT8 i;
if (money1<0x0a) {zdmoney[0]=zdmoney[0]+money1;}
else {zdmoney[0]=zdmoney[0]+money1-0x10;}
if (money2<0x0a) {zdmoney[1]=zdmoney[1]+money2;}
else {zdmoney[1]=zdmoney[1]+money2-0x10;}
if (money3<0x0a) {zdmoney[2]=zdmoney[2]+money3;}
else {zdmoney[2]=zdmoney[2]+money3-0x10;}
if (money4<0x0a) {zdmoney[3]=zdmoney[3]+money4;}
else {zdmoney[3]=zdmoney[3]+money4-0x10;}
if (money5<0x0a) {zdmoney[4]=zdmoney[4]+money5;}
else {zdmoney[4]=zdmoney[4]+money5-0x10;}
if (zdmoney[0]>=10)
{zdmoney[1]++;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -