📄 pccomm.lst
字号:
268 1 {
269 1 //here report failure
270 1 }*/
271 1 }
272 //////////////////////////////////////////////////////////////
273 void pcgetnewevent()
274 {
275 1 if(getnewevent())
276 1 {
277 2 //idata2idata(tempbuff,uart0buff+PCPACKAGEPARAMP,16);
278 2 idata2uart0(tempbuff,PCPACKAGEPARAMP,16);
279 2 ackpccmd(PCAGETNEWEVENT,RETWITHDATA,16);
280 2
281 2 //if(getpcok())removeoneevent();
282 2 removeeventflag=1;
283 2 getpcoktimer=timerh;
284 2
285 2 }
286 1 else
287 1 {
288 2 ackpccmd(PCAGETNEWEVENT,RETNODATA,0);
289 2 }
290 1 }
291 //////////////////////////////////////////////////////////////
292 void pcsetdatetime()
293 {
294 1 //here set the date and time
295 1
296 1 clock_write(CCENTURY,uart0buff[PCPACKAGEPARAMP]);
297 1 clock_write(CYEAR,uart0buff[PCPACKAGEPARAMP+1]);
298 1 clock_write(CMONTH,uart0buff[PCPACKAGEPARAMP+2]);
299 1 clock_write(CDAYOFMONTH,uart0buff[PCPACKAGEPARAMP+3]);
300 1 clock_write(CDAYOFWEEK,uart0buff[PCPACKAGEPARAMP+4]);
301 1 clock_write(CHOURS,uart0buff[PCPACKAGEPARAMP+5]);
302 1 clock_write(CMINUTES,uart0buff[PCPACKAGEPARAMP+6]);
C51 COMPILER V7.01 PCCOMM 03/08/2007 12:09:39 PAGE 6
303 1 clock_write(CSECONDS,uart0buff[PCPACKAGEPARAMP+7]);
304 1
305 1 getdatetime();
306 1 displaytime();
307 1
308 1 ackpccmd(PCASETDATETIME,RETOK,0);
309 1
310 1 }
311 //////////////////////////////////////////////////////////////
312 void pcsetts()
313 {
314 1 unsigned char tsindex;
315 1
316 1 tsindex=uart0buff[PCPACKAGEPARAMP];
317 1
318 1 //idata2idata(uart0buff+PCPACKAGEPARAMP+1,tempbuff,16);
319 1 uart02idata(PCPACKAGEPARAMP+1,tempbuff,16);
320 1 ram_write16(PAGETSSTART*16+tsindex,0);
321 1 ackpccmd(PCASETTS,RETOK,0);
322 1
323 1 }
324 //////////////////////////////////////////////////////////////
325 void pcsetholiday()
326 {
327 1 unsigned char holindex;
328 1
329 1 holindex=uart0buff[PCPACKAGEPARAMP];
330 1
331 1 //idata2idata(uart0buff+PCPACKAGEPARAMP+1,tempbuff,16);
332 1 uart02idata(PCPACKAGEPARAMP+1,tempbuff,16);
333 1 ram_write16(PAGEHOLSTART*16+holindex,0);
334 1
335 1 ackpccmd(PCASETHOLIDAY,RETOK,0);
336 1
337 1 }
338 //////////////////////////////////////////////////////////////
339 void pcgetdate()
340 {
341 1 //idata2idata(datetime,uart0buff+PCPACKAGEPARAMP,8);
342 1 idata2uart0(datetime,PCPACKAGEPARAMP,8);
343 1 ackpccmd(PCAGETDATE,RETOK,8);
344 1 }
345 //////////////////////////////////////////////////////////////
346 void pcgetts()
347 {
348 1 unsigned char tsindex;
349 1
350 1 tsindex=uart0buff[PCPACKAGEPARAMP];
351 1
352 1 ram_read16(PAGETSSTART*16+tsindex,0);
353 1 //idata2idata(tempbuff,uart0buff+PCPACKAGEPARAMP+1,16);
354 1 idata2uart0(tempbuff,PCPACKAGEPARAMP+1,16);
355 1 ackpccmd(PCAGETTS,RETOK,17);
356 1 }
357 //////////////////////////////////////////////////////////////
358 void pcgetholiday()
359 {
360 1 unsigned char holindex;
361 1
362 1 holindex=uart0buff[PCPACKAGEPARAMP];
363 1
364 1 ram_read16(PAGEHOLSTART*16+holindex,0);
C51 COMPILER V7.01 PCCOMM 03/08/2007 12:09:39 PAGE 7
365 1 //idata2idata(tempbuff,uart0buff+PCPACKAGEPARAMP+1,16);
366 1 idata2uart0(tempbuff,PCPACKAGEPARAMP+1,16);
367 1 ackpccmd(PCAGETHOLIDAY,RETOK,17);
368 1 }
369 //////////////////////////////////////////////////////////////
370 void pcsysinit()
371 {
372 1 initfpsystem();
373 1
374 1 ackpccmd(PCASYSINIT,RETOK,0);
375 1 }
376 //////////////////////////////////////////////////////////////
377 void pcidclear()
378 {
379 1 //deletealluser();
380 1 //rdeletealluser();
381 1 userclear();
382 1 ackpccmd(PCAIDCLEAR,RETOK,0);
383 1 }
384 //////////////////////////////////////////////////////////////
385 void pctsclear()
386 {
387 1 clearts();
388 1 ackpccmd(PCATSCLEAR,RETOK,0);
389 1 }
390 //////////////////////////////////////////////////////////////
391 void pceventclear()
392 {
393 1 clearevent();
394 1 ackpccmd(PCAEVENTCLEAR,RETOK,0);
395 1 }
396 //////////////////////////////////////////////////////////////
397 void pcsetmode()
398 {
399 1 unsigned char tempdata;
400 1 if(uart0buff[PCPACKAGEPARAMP]>=MAXSETMODESEL)return;
401 1
402 1 if(uart0buff[PCPACKAGEPARAMP+1]>=MAXMODEINDEX)return;
403 1
404 1 tempdata=uart0buff[PCPACKAGEPARAMP];
405 1
406 1 //if(tempdata>=MAXSETMODESEL)return;
407 1
408 1 ram_writep0(SECUMODE,tempdata);
409 1
410 1 tempdata=uart0buff[PCPACKAGEPARAMP+1];
411 1 ram_writep0(MODEINDEX,tempdata);
412 1 ackpccmd(PCASETMODE,RETOK,0);
413 1 }
414 //////////////////////////////////////////////////////////////
415 void pcsetduress()
416 {
417 1 unsigned char tempduress,tempduresspw;
418 1
419 1 tempduress=uart0buff[PCPACKAGEPARAMP];
420 1 tempduresspw=uart0buff[PCPACKAGEPARAMP+1];
421 1 if(tempduress>=MAXDURESSSEL)return;
422 1 if(tempduresspw>=MAXDURESSPW)return;
423 1
424 1 ram_writep0(DURESSMODE,tempduress);
425 1 ram_writep0(DURESSPW,tempduresspw);
426 1
C51 COMPILER V7.01 PCCOMM 03/08/2007 12:09:39 PAGE 8
427 1 ackpccmd(PCASETDURESS,RETOK,0);
428 1 }
429 //////////////////////////////////////////////////////////////
430 void pcsetinout()
431 {
432 1 unsigned char ioindex;
433 1
434 1 ioindex=uart0buff[PCPACKAGEPARAMP];
435 1 //idata2idata(uart0buff+PCPACKAGEPARAMP+1,tempbuff,16);
436 1 uart02idata(PCPACKAGEPARAMP+1,tempbuff,16);
437 1
438 1 ram_write16(ioindex,0);
439 1 ackpccmd(PCASETINOUT,RETOK,0);
440 1 }
441 //////////////////////////////////////////////////////////////
442 void pcgetinout()
443 {
444 1 unsigned char ioindex;
445 1
446 1 ioindex=uart0buff[PCPACKAGEPARAMP];
447 1 ram_read16(ioindex,0);
448 1 //idata2idata(tempbuff,uart0buff+PCPACKAGEPARAMP+1,16);
449 1 idata2uart0(tempbuff,PCPACKAGEPARAMP+1,16);
450 1
451 1 ackpccmd(PCAGETINOUT,RETOK,17);
452 1 }
453 //////////////////////////////////////////////////////////////
454 void pcsetapb()
455 {
456 1 unsigned char tempdata;
457 1
458 1 tempdata=uart0buff[PCPACKAGEPARAMP];
459 1
460 1 if(tempdata>=MAXSETAPBSEL)return;
461 1
462 1 ram_writep0(APBMODE,tempdata);
463 1 ackpccmd(PCASETAPB,RETOK,0);
464 1
465 1 }
466 //////////////////////////////////////////////////////////////
467 void pcsetkey()
468 {
469 1 //ram_write(KEYSTATE,0,uart1buff[1]);
470 1 unsigned char tempdata;
471 1
472 1 tempdata=uart0buff[PCPACKAGEPARAMP];
473 1
474 1 if(tempdata>=MAXPINKEYINSEL)return;
475 1
476 1 ram_writep0(KEYSTATE,tempdata);
477 1
478 1 ackpccmd(PCASETKEY,RETOK,0);
479 1 }
480 //////////////////////////////////////////////////////////////
481 void pcgetkey()
482 {
483 1 ackpccmd(PCRGETKEY,ram_readp0(KEYSTATE),1);
484 1 }
485 //////////////////////////////////////////////////////////////
486 void pcgetdoor()
487 {
488 1 unsigned char tempdata;
C51 COMPILER V7.01 PCCOMM 03/08/2007 12:09:39 PAGE 9
489 1 tempdata=0;
490 1 if(!(instate&bittbl[CONTACTCOUNT]))tempdata=1;
491 1
492 1 if(isdoorlocked())tempdata+=2;
493 1
494 1 uart0buff[PCPACKAGEPARAMP]=tempdata;
495 1
496 1 ackpccmd(PCAGETDOOR,RETOK,1);
497 1 }
498 //////////////////////////////////////////////////////////////
499 void pcsetdoor()
500 {
501 1 //doorstate=uart1buff[1];
502 1 unsigned char tempdata;
503 1
504 1 tempdata=uart0buff[PCPACKAGEPARAMP];
505 1 if(tempdata>=MAXDOORSTATE)return;
506 1
507 1 if(tempdata)
508 1 {
509 2 //set_373(DOORPORT);
510 2 lockdoor();
511 2 ackpccmd(PCRSETDOOR,RETOK,1);
512 2 }
513 1 else
514 1 {
515 2 //clr_373(DOORPORT);
516 2 unlockdoor();
517 2 ackpccmd(PCASETDOOR,RETOK,1);
518 2 }
519 1 }
520 //////////////////////////////////////////////////////////////
521 void pcsetram()
522 {
523 1 //DO nothing ????
524 1 ackpccmd(PCASETRAM,RETOK,0);
525 1 }
526 //////////////////////////////////////////////////////////////
527 void pcsetfunc()
528 {
529 1 //
530 1 unsigned char tempdata;
531 1
532 1 tempdata=uart0buff[PCPACKAGEPARAMP];
533 1 if(tempdata>=4)return;
534 1
535 1 switch(tempdata)
536 1 {
537 2 case 0: function1();break;
538 2 case 1: function2();break;
539 2 case 2: function3();break;
540 2 case 3: function4();break;
541 2 }
542 1 ackpccmd(PCASETFUNC,RETOK,0);
543 1
544 1 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -