⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lprtpos1.lst

📁 原创一个简单打小票POS机源代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
1270          ACC5=BT_REC;
1271          
1272          F_TM=0;
1273          while(!F_TM);
1274          ACC6=BT_REC;
1275          
1276          F_TM=0;
1277          while(!F_TM);
1278          ACC7=BT_REC;
1279          
1280          F_TM=0;
1281          
1282          while(!F_TM)
1283          {
1284          if(BT_REC)
1285          {
1286          break;
1287          }
1288          }
1289          TIMER0_DISABLE;*/ /*停止timer*/
1290          /*
1291          return ACC;
1292          #else
1293          UINT8 rch,ii;
C51 COMPILER V7.06   LPRTPOS1                                                              01/08/2007 10:43:11 PAGE 22  

1294          TIMER0_ENABLE;
1295          F_TM=0;
1296          ii=0;
1297          rch=0;
1298          while(!F_TM); *//*等过起始位*/
1299          /*
1300          while(ii<8)
1301          {
1302          rch>>=1;
1303          if(BT_REC)
1304          {
1305          rch|=0x80;
1306          }
1307          ii++;
1308          F_TM=0;
1309          while(!F_TM);
1310          
1311          }
1312          F_TM=0;
1313          while(!F_TM)
1314          {
1315          if(BT_REC)
1316          {
1317          break;
1318          }
1319          
1320          }
1321          TIMER0_DISABLE;*/ /*停止timer*/
1322          /*
1323          return rch;
1324          
1325          #endif
1326          
1327          }
1328          *//*注掉模拟接收字符函数2006-12-2*/
1329          /*检查是不是有起始位*/
1330          /*
1331          bit StartBitOn()
1332          {
1333          return  (BT_REC==0);
1334          }
1335          */
1336          /*模拟串口相关子程序11.0592MHZ*/
1337          
1338          /*小票打印相关子程序*/
1339          
1340          void thanks(void)
1341          {
1342   1      UINT8 x1,x2;
1343   1         PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
1344   1         PSendChar(0x1B);PSendChar(0x66);PSendChar(0);PSendChar(0x09);/*2个空格*/
1345   1         PSendChar(0xb7);PSendChar(0xc0);/*防*/
1346   1         PSendChar(0xce);PSendChar(0xb1);/*伪*/
1347   1         PSendChar(0xb1);PSendChar(0xea);/*标*/
1348   1         PSendChar(0xbc);PSendChar(0xc7);/*记*/
1349   1         PSendChar(0xa3);PSendChar(0xba);/*:*/   
1350   1         PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
1351   1          PSendChar(0x1b);PSendChar(0x36);
1352   1      /*0、1、2、3、4、5、6、7、8、9、.等字符*/
1353   1         PSendChar(0x20);
1354   1         
1355   1         x1=((time[6]^cred1)>>4); if (x1>9) {x1=15-x1+0x30;} else {x1=x1+0x30;}
C51 COMPILER V7.06   LPRTPOS1                                                              01/08/2007 10:43:11 PAGE 23  

1356   1         x2=(0x0f&(time[6]^cred1));if (x2>9) {x2=15-x2+0x30;} else {x2=x2+0x30;}
1357   1         PSendChar(x1);PSendChar(x2);
1358   1         x1=((time[5]^cred1)>>4);  if (x1>9) {x1=15-x1+0x30;} else {x1=x1+0x30;}
1359   1         x2=(0x0f&(time[5]^cred1));  if (x2>9) {x2=15-x2+0x30;} else {x2=x2+0x30;}
1360   1          PSendChar(x1);PSendChar(x2);
1361   1          x1=((time[3]^cred2)>>4);  if (x1>9) {x1=15-x1+0x30;} else {x1=x1+0x30;}
1362   1          x2=(0x0f&(time[3]^cred2));if (x2>9) {x2=15-x2+0x30;} else {x2=x2+0x30;}
1363   1          PSendChar(x1);PSendChar(x2);
1364   1      
1365   1         PSendChar(0x0D);/*换行   */
1366   1         PSendChar(0x1B);PSendChar(0x66);PSendChar(0);PSendChar(0x04
1367   1         );/*2个空格*/
1368   1         PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
1369   1         PSendChar(0xb8);PSendChar(0xd0);/*感*/
1370   1         PSendChar(0xd0);PSendChar(0xbb);/*谢*/
1371   1         PSendChar(0xbb);PSendChar(0xdd);/*惠*/
1372   1         PSendChar(0xb9);PSendChar(0xcb);/*顾*/
1373   1         PSendChar(0xa3);PSendChar(0xac);/*,*/
1374   1         PSendChar(0xc7);PSendChar(0xeb);/*请*/
1375   1         PSendChar(0xb1);PSendChar(0xa3);/*保*/
1376   1         PSendChar(0xb4);PSendChar(0xe6);/*存*/
1377   1         PSendChar(0xba);PSendChar(0xc3);/*好*/
1378   1         PSendChar(0xd0);PSendChar(0xa1);/*小*/
1379   1         PSendChar(0xc6);PSendChar(0xb1);/*票*/
1380   1         PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
1381   1      
1382   1         PSendChar(0x0D);/*换行   */
1383   1      }
1384          
1385          /*当日当次打印*/
1386          
1387          void cred(UINT8 x1,x2)
1388          {
1389   1      erase(0x6400);
1390   1      delay(3);
1391   1      wwr(0x6400,x1);
1392   1      wwr(0x6401,x2);
1393   1      wwr(0x6402,time[3]);
1394   1      }
1395          
1396          
1397          void prtd(UINT8 money1,money2,money3,money4,money5)
1398          {
1399   1       UINT8 x1,x2;
1400   1      prtinit();
1401   1      
1402   1        while(busy);
1403   1        PSendChar(0x1B);PSendChar(0x40);/*打印机初始化*/
1404   1        PSendChar(0x1B);PSendChar(0x31);PSendChar(0x06);/*3点行间距*/
1405   1        PSendChar(0x1B);PSendChar(0x66);PSendChar(1);PSendChar(0x02);/*2个空行*/
1406   1        PSendChar(0x1B);PSendChar(0x6C);PSendChar(0);  /*设置左限*/
1407   1        PSendChar(0x1B);PSendChar(0x51);PSendChar(0);/*设置右限*/
1408   1        PSendChar(0x1B);PSendChar(0x70);PSendChar(1);/*字符间距为2*/
1409   1        
1410   1         PSendChar(0x0D);/*换行   */
1411   1        
1412   1         thanks();
1413   1         PSendChar(0x0D);//换行  
1414   1        PSendChar(0x1b);PSendChar(0x36);/*字符集1*/
1415   1        for (x1=0;x1<14;x1++)
1416   1        {
1417   2         PSendChar(0x3d);PSendChar(0x20);/*=*/
C51 COMPILER V7.06   LPRTPOS1                                                              01/08/2007 10:43:11 PAGE 24  

1418   2        } 
1419   1         PSendChar(0x3d); 
1420   1         PSendChar(0x0D);//换行
1421   1         PSendChar(0x1B);PSendChar(0x66);PSendChar(0);PSendChar(0x06);/*2个空格*/
1422   1         PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
1423   1         PSendChar(0xcf);PSendChar(0xd6);/*现*/
1424   1         PSendChar(0xbd);PSendChar(0xf0);/*金*/
1425   1         PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
1426   1         PSendChar(0x1b);PSendChar(0x36);/*字符集1*/  
1427   1        for (x1=0;x1<7;x1++)
1428   1        {
1429   2        PSendChar(0x20); 
1430   2        } 
1431   1          PSendChar(0x20+money1);
1432   1          PSendChar(0x20+money2);PSendChar(0x20+money3);
1433   1          PSendChar(0x2e);PSendChar(0x30+money4);
1434   1          PSendChar(0x30+money5);
1435   1        PSendChar(0x0D);//换行
1436   1        PSendChar(0x1b);PSendChar(0x36);/*字符集1*/  
1437   1        for (x1=0;x1<14;x1++)
1438   1        {
1439   2         PSendChar(0x2d);PSendChar(0x20);/*-*/
1440   2        } 
1441   1         PSendChar(0x2d);
1442   1         
1443   1         PSendChar(0x0D);//换行
1444   1         PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
1445   1         PSendChar(0xb2);PSendChar(0xbf);/*部*/
1446   1         PSendChar(0xc0);PSendChar(0xe0);/*类*/
1447   1         PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/  
1448   1         PSendChar(0x1b);PSendChar(0x36);/*字符集1*/   
1449   1         PSendChar(0x30);PSendChar(0x30+unit); 
1450   1         for (x1=0;x1<14;x1++)
1451   1        {
1452   2        PSendChar(0x20);
1453   2        } 
1454   1          PSendChar(0x20+money1);
1455   1          PSendChar(0x20+money2);PSendChar(0x20+money3);
1456   1          PSendChar(0x2e);PSendChar(0x30+money4);
1457   1          PSendChar(0x30+money5);
1458   1         
1459   1        PSendChar(0x0D);//换行
1460   1        PSendChar(0x1b);PSendChar(0x36);/*字符集1*/  
1461   1        for (x1=0;x1<14;x1++)
1462   1        {
1463   2         PSendChar(0x2d);PSendChar(0x20);/*-*/
1464   2        } 
1465   1          PSendChar(0x2d);
1466   1          
1467   1         PSendChar(0x0D);//换行
1468   1         PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
1469   1         PSendChar(0xc8);PSendChar(0xd5);/*日*/
1470   1         PSendChar(0xc6);PSendChar(0xda);/*期*/
1471   1      //   PSendChar(0xa3);PSendChar(0xba);/*:*/
1472   1         PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
1473   1      /*打印日期数字*/
1474   1         PSendChar(0x1B);PSendChar(0x36); PSendChar(0x3a);
1475   1      
1476   1      /*0、1、2、3、4、5、6、7、8、9、.等字符*/
1477   1      
1478   1          PSendChar(0x32);PSendChar(0x30);
1479   1          x1=((time[6]>>4)+0x30);x2=((0x0f&time[6])+0x30);
C51 COMPILER V7.06   LPRTPOS1                                                              01/08/2007 10:43:11 PAGE 25  

1480   1          PSendChar(x1);PSendChar(x2);
1481   1          PSendChar(0x2d);
1482   1          x1=((time[5]>>4)+0x30);x2=((0x0f&time[5])+0x30);
1483   1          PSendChar(x1);PSendChar(x2);
1484   1          PSendChar(0x2d);
1485   1          x1=((time[3]>>4)+0x30);x2=((0x0f&time[3])+0x30);
1486   1          PSendChar(x1);PSendChar(x2);
1487   1           PSendChar(0x20);
1488   1        
1489   1         PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
1490   1         PSendChar(0xca);PSendChar(0xb1);/*时*/
1491   1         PSendChar(0xbc);PSendChar(0xe4);/*间*/
1492   1         PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
1493   1           
1494   1           
1495   1           
1496   1          PSendChar(0x1B);PSendChar(0x36); PSendChar(0x3a);
1497   1          x1=((time[2]/16)+0x30);x2=((time[2]%16)+0x30);
1498   1          PSendChar(x1);PSendChar(x2);
1499   1          PSendChar(0x3a);
1500   1          x1=((time[1]/16)+0x30);x2=((time[1]%16)+0x30);
1501   1          PSendChar(x1);PSendChar(x2);
1502   1          PSendChar(0x3a);
1503   1          x1=((time[0]/16)+0x30);x2=((time[0]%16)+0x30);
1504   1          PSendChar(x1);PSendChar(x2);          
1505   1         
1506   1         
1507   1         PSendChar(0x0D);//换行
1508   1         PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
1509   1         PSendChar(0xca);PSendChar(0xd5);/*收*/
1510   1         PSendChar(0xbe);PSendChar(0xdd);/*据*/   
1511   1         PSendChar(0xba);PSendChar(0xc5);/*号*/   
1512   1         //PSendChar(0xa3);PSendChar(0xba);/*:*/
1513   1         PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
1514   1         PSendChar(0x1b);PSendChar(0x36);/*字符集1*/
1515   1          PSendChar(0x3a);
1516   1      
1517   1         
1518   1        for (x1=0;x1<4;x1++)
1519   1        {
1520   2         PSendChar(0x30);/*0*/
1521   2        } 
1522   1        PSendChar(0x23);/*#*/  
1523   1          x1=((cred2/10)+0x30);x2=((cred2%10)+0x30);
1524   1          PSendChar(x1);PSendChar(x2);
1525   1          x1=((cred1/10)+0x30);x2=((cred1%10)+0x30);
1526   1          PSendChar(x1);PSendChar(x2);
1527   1         PSendChar(0x20);
1528   1         PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
1529   1         PSendChar(0xca);PSendChar(0xd5);/*收*/
1530   1         PSendChar(0xbf);PSendChar(0xee);/*款*/   
1531   1      //   PSendChar(0xa3);PSendChar(0xba);/*:*/
1532   1         PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
1533   1         
1534   1          PSendChar(0x1b);PSendChar(0x36);/*字符集1*/  
1535   1          PSendChar(0x3a);
1536   1      
1537   1         PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
1538   1         PSendChar(0xca);PSendChar(0xd5);/*收*/
1539   1         PSendChar(0xbf);PSendChar(0xee);/*款*/   
1540   1         PSendChar(0xd4);PSendChar(0xb1);/*员*/   
1541   1         PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
C51 COMPILER V7.06   LPRTPOS1                                                              01/08/2007 10:43:11 PAGE 26  

1542   1         PSendChar(0x1b);PSendChar(0x36);/*字符集1*/
1543   1         PSendChar(0x30);PSendChar(0x31);    
1544   1      
1545   1         PSendChar(0x0D);//换行
1546   1         PSendChar(0x1b);PSendChar(0x36);/*字符集1*/
1547   1      
1548   1        for (x1=0;x1<14;x1++)
1549   1        {
1550   2         PSendChar(0x3d);PSendChar(0x20);/*=*/
1551   2        } 
1552   1         PSendChar(0x3d); 
1553   1         PSendChar(0x0D);//换行
1554   1         PSendChar(0x1B);PSendChar(0x66);PSendChar(0);PSendChar(0x0a);/*2个空格*/
1555   1         PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
1556   1         PSendChar(0xca);PSendChar(0xd5);/*收*/
1557   1         PSendChar(0xd2);PSendChar(0xf8);/*银*/   
1558   1         PSendChar(0xc6);PSendChar(0xbe);/*凭*/
1559   1         PSendChar(0xbe);PSendChar(0xdd);/*据*/   
1560   1         PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
1561   1       
1562   1         PSendChar(0x0D);//换行
1563   1         
1564   1         
1565   1         /*设置大字体*/
1566   1       //  PSendChar();
1567   1         PSendChar(0x1B);PSendChar(0x55);PSendChar(1);/*汉字放大*/
1568   1         PSendChar(0x1B);PSendChar(0x56);PSendChar(2);/*汉字放大*/
1569   1      //
1570   1        PSendChar(0x1B);PSendChar(0x66);PSendChar(0);PSendChar(0x06);/*2个空格*/
1571   1       //   PSendChar(0x1C);PSendChar(0x0e);/*汉字放大*/
1572   1        // PSendChar(0x1B);PSendChar(0x55);PSendChar(0);PSendChar(0x02);/*2个空格*/
1573   1      
1574   1         PSendChar(0x1c);PSendChar(0x26);/*进入汉字打印模式*/
1575   1      //   PSendChar(0x1C);PSendChar(0x57);PSendChar(2);/*汉字放大*/
1576   1         PSendChar(0xd2);PSendChar(0xf8);/*银*/
1577   1         PSendChar(0xba);PSendChar(0xd3);/*河*/
1578   1         PSendChar(0xbf);PSendChar(0xa8);/*卡*/
1579   1         PSendChar(0xcf);PSendChar(0xb5);/*系*/
1580   1         PSendChar(0xc1);PSendChar(0xd0);/*列*/
1581   1         PSendChar(0xca);PSendChar(0xd5);/*收*/
1582   1         PSendChar(0xd2);PSendChar(0xf8);/*银*/   
1583   1         PSendChar(0xbb);PSendChar(0xfa);/*机*/   
1584   1       //  PSendChar(0x1C);PSendChar(0x57);PSendChar(1);/*汉字放大*/
1585   1      
1586   1         PSendChar(0x1c);PSendChar(0x2E);/*退出汉字打印模式*/
1587   1       //  PSendChar(0x1C);PSendChar(0x57);PSendChar

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -