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

📄 stccoinboxnew.lst

📁 投币按摩椅驱动程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
1151   1           uchar nCnt;
1152   1           for(nCnt=3;nCnt<=5;nCnt++) { writeData(nCnt,g8563_Store[nCnt-2]); }
1153   1          writeData(7,g8563_Store[5]);
1154   1          writeData(8,g8563_Store[6]);
1155   1      }
1156          /********************************************
1157          P8563的初始化-----外部调用
1158          ********************************************/
1159          void P8563_init()
1160          {
1161   1      //    uchar nCnt;
1162   1          if((ReadData(0xa)&0x3f)!=0x8) /*检查是否第一次启动,是则初始化时间*/
C51 COMPILER V8.05a   STCCOINBOXNEW                                                        01/26/2008 08:39:50 PAGE 20  

1163   1          {
1164   2             //for(nCnt=0;nCnt<=3;nCnt++) g8563_Store[nCnt]=c8563_Store[nCnt]; /*初始化时间*/
1165   2              P8563_Read();
1166   2              P8563_settime();
1167   2              writeData(0x0,0x00);
1168   2              //writeData(0xa,0x8); /*8:00报警*/
1169   2              //writeData(0x1,0x12); /*报警有效*/
1170   2              writeData(0xd,0x00);
1171   2          }
1172   1      }
1173          
1174          
1175          /**************************PCF8563**************************************/
1176          /////////////////////////////////////////////////////////
1177          void Lcd(void)
1178          {
1179   1      ////////////////
1180   1                if(bDotShow == FALSE)        //FALSE//TRUE
1181   1                  { DotOff; } 
1182   1                else
1183   1                  {
1184   2                       DotOn2; 
1185   2                      //if(!bKeyok_Set) DotOn1; 
1186   2                  }
1187   1                  
1188   1                if((nSpareMoney < Init_CoinValue)&&(T_Status==0)&&(keystatus==0))
1189   1                  {
1190   2                  if(bShowMoneyTotalPermit==1)
1191   2                  {
1192   3                 // for(nCnt=4;nCnt<10;nCnt++)Lcddis[nCnt]=LcdSeg[10];
1193   3                  TotalMoneyOn;Delay();
1194   3                 // Disp_Process();
1195   3                  }
1196   2                  else
1197   2                  {
1198   3      //      for(nCnt=4;nCnt<10;nCnt++)Lcddis[nCnt]=LcdSeg[10];
1199   3                   Nop;
1200   3                   Nop;
1201   3                 //  InitMoneyOn;
1202   3                   }
1203   2                   } 
1204   1      
1205   1      //////////////////////////////////////
1206   1              switch ( nDisCount )
1207   1              {
1208   2                      case 0:
1209   2                              nLcdDisplay1 = Lcddis[0];
1210   2                              nLcdDisplay2 = Lcddis[0];
1211   2                              nLcdDisplay2 >>= 4;
1212   2                              LcdSendData(0,nLcdDisplay1);
1213   2                              LcdSendData(1,nLcdDisplay2);
1214   2                              nDisCount = 1;
1215   2                              break;
1216   2                      case 1:
1217   2                              nLcdDisplay1 = Lcddis[1];
1218   2                              nLcdDisplay2 = Lcddis[1];
1219   2                              nLcdDisplay2 >>= 4;
1220   2                              LcdSendData(2,nLcdDisplay1);
1221   2                              LcdSendData(3,nLcdDisplay2);
1222   2                              nDisCount = 2;
1223   2                              break;
1224   2                      case 2:
C51 COMPILER V8.05a   STCCOINBOXNEW                                                        01/26/2008 08:39:50 PAGE 21  

1225   2                              nLcdDisplay1 = Lcddis[2]; 
1226   2                              nLcdDisplay2 = Lcddis[2];
1227   2                              nLcdDisplay2 >>= 4;
1228   2                              LcdSendData(4,nLcdDisplay1);
1229   2                              LcdSendData(5,nLcdDisplay2);
1230   2                              nDisCount = 3;
1231   2                              break;
1232   2                      case 3:
1233   2                              nLcdDisplay1 = Lcddis[3]; 
1234   2                              nLcdDisplay2 = Lcddis[3]; 
1235   2                              nLcdDisplay2 >>= 4;
1236   2                              LcdSendData(6,nLcdDisplay1);
1237   2                              LcdSendData(7,nLcdDisplay2);
1238   2                              nDisCount = 4;
1239   2                              break;
1240   2                      case 4:
1241   2                              nLcdDisplay1 = Lcddis[4]; 
1242   2                              nLcdDisplay2 = Lcddis[4]; 
1243   2                              nLcdDisplay2 >>= 4;
1244   2                              LcdSendData(8,nLcdDisplay1);
1245   2                              LcdSendData(9,nLcdDisplay2);
1246   2                              nDisCount = 5;
1247   2                              break;
1248   2                      case 5:
1249   2                              nLcdDisplay1 = Lcddis[5]; 
1250   2                              nLcdDisplay2 = Lcddis[5]; 
1251   2                              nLcdDisplay2 >>= 4;
1252   2                              LcdSendData(10,nLcdDisplay1);
1253   2                              LcdSendData(11,nLcdDisplay2);
1254   2                              nDisCount = 6;
1255   2                              break;
1256   2                      case 6:
1257   2                              nLcdDisplay1 = Lcddis[6]; 
1258   2                              nLcdDisplay2 = Lcddis[6]; 
1259   2                              nLcdDisplay2 >>= 4;
1260   2                              LcdSendData(12,nLcdDisplay1);
1261   2                              LcdSendData(13,nLcdDisplay2);
1262   2                              nDisCount = 7;
1263   2                              break;
1264   2                      case 7:
1265   2                              nLcdDisplay1 = Lcddis[7]; 
1266   2                              nLcdDisplay2 = Lcddis[7]; 
1267   2                              nLcdDisplay2 >>= 4;
1268   2                              LcdSendData(14,nLcdDisplay1);
1269   2                              LcdSendData(15,nLcdDisplay2);
1270   2                              nDisCount = 8;
1271   2                              break;
1272   2                      case 8:
1273   2                              nLcdDisplay1 = Lcddis[8]; 
1274   2                              nLcdDisplay2 = Lcddis[8]; 
1275   2                              nLcdDisplay2 >>= 4;
1276   2                              LcdSendData(16,nLcdDisplay1);
1277   2                              LcdSendData(17,nLcdDisplay2);
1278   2                              nDisCount = 9;
1279   2                              break;
1280   2                      case 9:
1281   2                              nLcdDisplay1 = Lcddis[9]; 
1282   2                              nLcdDisplay2 = Lcddis[9]; 
1283   2                              nLcdDisplay2 >>= 4;
1284   2                              LcdSendData(18,nLcdDisplay1);
1285   2                              LcdSendData(19,nLcdDisplay2);
1286   2                              nDisCount = 10;
C51 COMPILER V8.05a   STCCOINBOXNEW                                                        01/26/2008 08:39:50 PAGE 22  

1287   2                              break;
1288   2                      case 10:
1289   2                              nLcdDisplay1 = Lcddis[10]; 
1290   2                              nLcdDisplay2 = Lcddis[10]; 
1291   2                              nLcdDisplay2 >>= 4;
1292   2                              LcdSendData(20,nLcdDisplay1);
1293   2                              LcdSendData(21,nLcdDisplay2);
1294   2                              nDisCount = 11;
1295   2                              break;
1296   2                      case 11:
1297   2                              nLcdDisplay2 = Lcddis[11]; 
1298   2                              LcdSendData(22,nLcdDisplay1);
1299   2                              nDisCount = 0;
1300   2                              break;
1301   2                      default:
1302   2                              nDisCount = 0;
1303   2                              break;
1304   2              }
1305   1      }
1306          
1307          void LcdSendCommand(uchar nCommand)
1308          {
1309   1              uchar nCount ;
1310   1              unsigned int nSerialData ;
1311   1              //bit bSendBit ;
1312   1              bLcdData = HIGH ;
1313   1              bLcdClock = HIGH ;
1314   1              bLcdCS  = LOW  ;
1315   1              nSerialData = 0x0400 | nCommand ;
1316   1              for(nCount=0;nCount<12;nCount++)
1317   1              {
1318   2                      if(nSerialData & 0x0400)
1319   2                      {
1320   3                              bSendBit = 1 ;
1321   3                      }
1322   2                      else
1323   2                      {
1324   3                              bSendBit = 0 ;
1325   3                      }
1326   2                      bLcdData = bSendBit ;
1327   2                      NOP() ;
1328   2                      bLcdClock = LOW ;
1329   2                      Delay();
1330   2                      bLcdClock = HIGH ;
1331   2                      nSerialData <<= 1 ;
1332   2              }
1333   1              bLcdCS = HIGH ;
1334   1      }
1335          
1336          void LcdSendData(uchar nAddress,uchar nData)
1337          {
1338   1              uchar nCount ;
1339   1              unsigned int  nSerialData ;
1340   1              //bit bSendBit ;
1341   1              bLcdData = HIGH ;
1342   1              bLcdClock = HIGH ;
1343   1              bLcdCS  = LOW  ;
1344   1              nAddress &= 0x3f ;
1345   1              nData &= 0x0f ;
1346   1              nSerialData = 0x0140 | nAddress ;
1347   1              nSerialData <<= 4 ;
1348   1              nSerialData |= nData ;//*nData:低位在前*/
C51 COMPILER V8.05a   STCCOINBOXNEW                                                        01/26/2008 08:39:50 PAGE 23  

1349   1              for(nCount=0;nCount<13;nCount++)
1350   1              {
1351   2                      if(nSerialData & 0x1000)
1352   2                      {
1353   3                              bSendBit = 1 ;
1354   3                      }
1355   2                      else
1356   2                      {
1357   3                              bSendBit = 0 ;
1358   3                      }
1359   2                      bLcdData = bSendBit ;
1360   2                      Delay();
1361   2                      bLcdClock = LOW ;
1362   2                      Delay();
1363   2                      bLcdClock = HIGH ;
1364   2                      nSerialData <<= 1 ;
1365   2              }
1366   1              bLcdCS = HIGH ;
1367   1      }
1368          /////////////////////////////////////////////////////////////////
1369          /*******************************************************/
1370          /******************按键扫描处理************************************/
1371          /******************************************************************/
1372          void Timer0() interrupt 1 using 2
1373          {
1374   1              TH0=0xf8;  //TH0 = 0xf8;   //2ms for 12MHZ 
1375   1              TL0=0xcd;  //TL0 = 0x30;
1376   1      
1377   1              P2 = P2|0x08;
1378   1        //P3 = 0x7f;
1379   1        P1|=0x04;
1380   1        bKey_Test=P1&0x04;
1381   1              P1 = P1|KeyOff;
1382   1              nTimeCounter++;
1383   1              SendTime++;
1384   1              ReceiveTime++;
1385   1              Cointime++;
1386   1      //        Movtime++;
1387   1              Totaltime++;
1388   1              if(bPulseFirstCount)nPulseDelayTime++;
1389   1                      //if(nPulseDelayTime>3000){nPulseDelayTime=0;bPulseFirstCount=0;}
1390   1        if(bBuzzDelayPermit)nBuzzDelayTime++;
1391   1        if(bBuzzDelayPermit1)nBuzzDelayTime++;        
1392   1        if(!bKeyok_Set)nflashOnOffDelayTime++;
1393   1       if((nSpareMoney ==0)&&(keystatus==0)&&(T_Status==0)&&(!bCoinPower))
1394   1              {
1395   2                      nSpeakDelay++;
1396   2                      nSpeakFlashTime++;
1397   2              }  
1398   1                      else {nSpeakDelay=0;nSpeakFlashTime=0;bSpeakPermit=0;}
1399   1              if(bTansmitMoneyFull_Delay1Minute)nTansmitMoneyFull_Delay++;
1400   1                      if(nTansmitMoneyFull_Delay>30000){nTansmitMoneyFull_Delay=0;bTansmitMoneyFull_Delay1Minute=0;}
1401   1      //  if((bClearTotalCoinPermit)||(bClearTotalNumberPermit))nClearKeyCounter++;           
1402   1              if(bStartTC35iPermit)GsmDelayTime++;            
1403   1               if(bDelay20mS)GsmDelayTime++;  
1404   1            //   if(bDelay160mS)Delay160mSTime++;
1405   1               //      if(Delay160mSTime>80){Delay160mSTime=0;bDelay160mS=0;}
1406   1              // if(bDelay1S)Delay1STime++;
1407   1              //       if(Delay1STime>500){Delay1STime=0;bDelay1S=0;}
1408   1              //if(bDelay3S)GsmDelayTime++;
1409   1              if((GsmDelayTime>10)&&(bDelay20mS)){GsmDelayTime=0;bDelay20mS=0;}
1410   1              if(GsmDelayTime>1500){GsmDelayTime=0;bStartTC35iPermit=0;}//bDelay3S=0; 
C51 COMPILER V8.05a   STCCOINBOXNEW                                                        01/26/2008 08:39:50 PAGE 24  

1411   1             // if(StartUpDelayTime>100){GsmDelayTime=0;bStartTC35iPermit=0; }              
1412   1              keydata1 = P1&KeyOff;  
1413   1      /**********************Check coin signal for part A*********/
1414   1      ////////////////////////////////////////////////////////////
1415   1      if((T_Status==0)&&(nSpareMoney==0))
1416   1      {
1417   2              
1418   2              if(((keydata1!=KeyOff)||(bSensorCheck==0))&&(bCheckCoinA == 1))
1419   2              {
1420   3      //////////////////////////////////////////////////////////
1421   3                      nKeyHighLevel2Counter++;
1422   3                      nKeyLowLevel2Counter = 0;
1423   3                      if(nKeyHighLevel2Counter>=KeyMaxHighLevel)
1424   3                      {
1425   4                              nKeyProcessStep2 = 1;
1426   4                              //nKeyHighLevel2Counter =KeyMaxHighLe;
1427   4            if(bSensorCheck==0)//霍尔检测,显示投币总金额
1428   4             {
1429   5              bShowMoneyTotalPermit=1;
1430   5               bShowTotalcoinsumPermit=1;
1431   5               bdisp=1;Disp_Process();
1432   5               keystatus=0;
1433   5               Totaltime=0;
1434   5              }
1435   4                               keydata = keydata1;
1436   4                               bKeyPermit = FALSE;
1437   4                              // if(nKeyHighLevel2Counter==KeyMaxHighLevel)
1438   4                              // {Movtime=0;}
1439   4                           

⌨️ 快捷键说明

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