📄 main.lst
字号:
259 1 else flag=0;
260 1 switch(month)
261 1 {
262 2 case 1:
263 2 case 3:
264 2 case 5:
265 2 case 7:
266 2 case 8:
267 2 case 10:
268 2 case 12:
269 2 if((day>=1)&&(day<=31))return 1;//月大
270 2 else return 0;
271 2 case 2:
272 2 if(flag)
273 2 {
274 3 if((day>=1)&&(day<=29)) return 1;
275 3 else return 0;
276 3 }
277 2 else
278 2 {
279 3 if((day>=1)&&(day<=28)) return 1;
280 3 else return 0;
281 3 }
282 2
283 2 case 4:
284 2 case 6:
285 2 case 9:
286 2 case 11:
287 2 if((day>=1)&&(day<=30))return 1;//月小
288 2 else
289 2 return 0;
290 2 default: return 0;
291 2 }
292 1 }
293
294
295
296
297
298 void SysIni()
299 {
300 1 IE=0;
301 1 IEA = 0;
302 1
C51 COMPILER V8.01 MAIN 03/28/2006 09:48:48 PAGE 6
303 1 DisableCom; //关串口
304 1
305 1 //DisableCs; //打印机中断信号
306 1 WDKEY=0x55; //Disable Watchdog
307 1 WDRST=0xFF;
308 1
309 1 RCAP2H = 0;
310 1 RCAP2L = 0;
311 1 TL1 = 0;
312 1 TH1 = 0;
313 1 PCON = 0;
314 1
315 1
316 1 P1SFS=0; //只有高4位有效
317 1 P3SFS=0; //只有高2位有效
318 1 P4SFS=0; //Set P4 as General i/o Port
319 1
320 1
321 1
322 1
323 1 PSD_REG.CONTROL_A=0; //sets the port A to MCU I/O Mode
324 1 PSD_REG.DRIVE_A = 0; //set port A Slew Rate
325 1 PSD_REG.DIRECTION_A &= 0xFB;//set port PA2 input
326 1
327 1
328 1 PSD_REG.CONTROL_B=0; //sets the port B to MCU I/O Mode
329 1 PSD_REG.DRIVE_B = 0; //set port B Slew Rate
330 1 PSD_REG.DIRECTION_B=0xFF; //set port B output
331 1
332 1 PSD_REG.DATAOUT_B = 0xFF;
333 1
334 1
335 1 PSD_REG.DRIVE_C=0;
336 1 PSD_REG.DIRECTION_C &= 0x7F;//0:InPUT 1:OUTPUT
337 1
338 1
339 1 PSD_REG.DIRECTION_D=0x06; //set Port D output
340 1
341 1
342 1 RxdNum=0;
343 1 RxdLen=0;
344 1 TxdNum=0;
345 1 TxdLen=0;
346 1
347 1
348 1 TR1=0;TR0=0;
349 1 IT0=0;
350 1 IP=0x01;
351 1 IPA=0;
352 1 IT0=1;
353 1 IT1=1;
354 1 EA = 1;
355 1 IEA = 1;
356 1 EX0=1;
357 1 EX1=0;
358 1
359 1 }
360
361
362 void SysFunction() //系统功能函数入口
363 {
364 1 uchar k=1,str[4];
C51 COMPILER V8.01 MAIN 03/28/2006 09:48:48 PAGE 7
365 1 // gyt4 tp;
366 1
367 1 while(1)
368 1 {
369 2 WindowsSet(6);
370 2 strcpy(&WinHint[0][1],"1.报表查询");
371 2 strcpy(&WinHint[1][1],"2.商品管理");
372 2 strcpy(&WinHint[2][1],"3.权限管理");
373 2 strcpy(&WinHint[3][1],"4.税务功能");
374 2 strcpy(&WinHint[4][1],"5.自检");
375 2 strcpy(&WinHint[5][1],"6.测试");
376 2
377 2
378 2
379 2 str[0]=K_TC;
380 2 str[1]=K_HJ;
381 2 str[2]=0;
382 2
383 2 k=Windows(k,0,str);
384 2
385 2 if(str[0]==K_TC)return;
386 2
387 2 switch(k)
388 2 {
389 3 case 1:
390 3 Report();
391 3 break;
392 3
393 3 case 2:
394 3 ManageSet();
395 3 break;
396 3
397 3 case 3:
398 3 SalerManage();
399 3 break;
400 3
401 3 case 4: TaxManage();
402 3 break;
403 3
404 3 case 5: CheckSystem();
405 3 break; //自检
406 3
407 3 case 6: PosTest();
408 3 break;
409 3
410 3 default : Beep(400);
411 3 break;
412 3 }
413 2 }
414 1 }
415
416 void Test()
417 {
418 1 uchar dat[50];
419 1 uchar cat[50];//,str[2];
420 1 uchar i,j;
421 1 i=10;
422 1 while(i--)
423 1 {
424 2 Beep(2);
425 2
426 2 }
C51 COMPILER V8.01 MAIN 03/28/2006 09:48:48 PAGE 8
427 1 /*while(1)
428 1 {
429 1 //KeyScan();
430 1 i=KeyScan();
431 1 // UartRxd(8,dat);
432 1 UartTxd(1,&i);
433 1 //KeyScan();
434 1 }*/
435 1 /*while(1)
436 1 {
437 1 UartRxd(5,dat);
438 1 Memory_Write(800,7,dat);
439 1 Memory_Read(800,7,cat);
440 1 UartTxd(5,cat);
441 1 }
442 1 UartTxd(10,"1234567891");
443 1 //LcdDisplay(16,64,"uart Test",3);
444 1 // KeyScan(); */
445 1
446 1
447 1
448 1 // memset(dat,0,25);
449 1 // ReadDate();
450 1 // PrintStartToEnd(InvoDate);
451 1 // x=8400;
452 1 // NumToStr(x,dat,SwitchFloat);
453 1 // LcdDisplay(16,0,dat,3);
454 1 // KeyScan();
455 1 // UartTxd(7,"--------");
456 1 // SimRstCold(0);
457 1 // UartTxd(18,RxdBuf);
458 1 // UartTxd(8,"++++++++");
459 1 // RxdBuf[0]=0x2F;
460 1 // RxdBuf[1]=0x02;
461 1 // SelectFile(0x00,0x00,0x02,RxdBuf,0);
462 1 // RxdBuf[0]=0xEF;
463 1 // RxdBuf[1]=0x02;
464 1 // SelectFile(0x00,0x00,0x02,RxdBuf,0);
465 1 // UartTxd(7,"--------");
466 1 // UartTxd(15,RxdBuf);
467 1 // UartTxd(7,"++++++++");
468 1 // SimRstCold(1);
469 1 // UartTxd(18,RxdBuf);
470 1 // UartTxd(7,"--------");
471 1 // RxdBuf[0]=0x2F;
472 1 // RxdBuf[1]=0x02;
473 1 // SelectFile(0x00,0x00,0x02,RxdBuf,1);
474 1 // RxdBuf[0]=0xEF;
475 1 // RxdBuf[1]=0x05;
476 1 // SelectFile(0x00,0x00,0x02,RxdBuf,1);
477 1 // UartTxd(18,RxdBuf);
478 1 // UartTxd(7,"++++++++");
479 1 }
*** WARNING C280 IN LINE 418 OF MAIN.C: 'dat': unreferenced local variable
*** WARNING C280 IN LINE 419 OF MAIN.C: 'cat': unreferenced local variable
*** WARNING C280 IN LINE 420 OF MAIN.C: 'j': unreferenced local variable
480
481
482 void DataProtect()
483 {
484 1 // SimFlg=0;
485 1 I2cRead(PwrFlgAdr,1,&PwrFlg);
C51 COMPILER V8.01 MAIN 03/28/2006 09:48:48 PAGE 9
486 1 if(PwrFlg==0)return;
487 1
488 1 if(PwrFlg==0x55)
489 1 {//M25P80的数据是存在SRAM中还是存在24C64中?
490 2 LcdDisplay(16,0,"掉电时的数据已经处理!",3);
491 2 }
492 1
493 1 else
494 1 // if(PwrFlg==0xAA)
495 1 {
496 2 LcdDisplay(16,0,"掉电时的数据没有处理!",3);
497 2 }
498 1
499 1 LcdDisplay(32,32,"<按任意键继续>",0);
500 1
501 1 WDKEY=0x55;
502 1 KeyScan();
503 1 PwrFlg=0;
504 1 I2cWrite(PwrFlgAdr,1,&PwrFlg);
505 1 }
506
507
508 void ClearRam()
509 {
510 1 uchar xdata *xp;
511 1
512 1 xp=(uchar *)0x300;
513 1 while(xp<0x8000)
514 1 {
515 2 *(xp++)=0;
516 2 }
517 1 }
518
519
520
521
522
523 void main()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -