C51 COMPILER V6.00 FPGA 05/30/2001 17:04:13 PAGE 1 C51 COMPILER 6.00, COMPILATION OF MODULE FPGA OBJECT MODULE PLACED IN .\fpga.OBJ COMPILER INVOKED BY: d:\app\keil\eval\C51\BIN\C51.EXE .\fpga.c BROWSE OBJECTEXTEND DEBUG stmt level source 1 /* fpga.c */ 2 3 #include "door.h" 4 #include "fpga.h" 5 6 /* # of 25 ms before timeout */ 7 /* time out flag */ 8 static bit done = 0; 9 static bit timeOut = 0; 10 static bit runFPGA = 1; 11 12 unsigned char subseconds = 0; 13 unsigned char seconds = 0; 14 15 char xdata *led = 0x0f000; // the FPGA is configured to memory map led to this address 16 17 void FPGA_Task() { 18 1 /* set timer */ 19 1 PCON = PCON | 0x80; 20 1 TMOD = 0x21; 21 1 22 1 /* Set up and enable Timer0 for a 1 millisecond timer */ 23 1 TL0 = FPGA_RELOAD_LO_B; /* Load the timer high and low bytes */ 24 1 TH0 = FPGA_RELOAD_HI_B; 25 1 EA = 1; /* Enable the global interrupt */ 26 1 EX1 = 1; /* Enable the external interrupt 1 */ 27 1 IT0 = 1; /* Enable the TCON for falling edge trigger */ 28 1 29 1 runFPGA = 1; 30 1 done = 0; 31 1 timeOut = 0; 32 1 // T0 = 1; // Request = 1 33 1 // T1 = 1; // p3.5: pin 22, Request = 0 34 1 T1 = 0; // p3.5: pin 22, inv(Request) = 1 35 1 TR0 = 1; /* Start the timer 0 */ 36 1 ET0 = 1; /* Enable the timer interrupt 0 (Page 55) */ 37 1 PT0 = 1; /* Timer 0 Interrupt Priority */ 38 1 IE0 = 0; 39 1 *led = 0x52; // 7 40 1 while (runFPGA) { 41 2 if((done) || (timeOut)) 42 2 { 43 3 *led = 0xFF; //8 44 3 ET0 = 0; // disable timer interrupt 0 45 3 EX0 = 0; // disable ext int 0 46 3 EX1 = 0; // disable ext int 1 47 3 EA = 0; 48 3 // T1 = 0; // p3.5: pin 22, Request = 1 49 3 T1 = 1; // p3.5: pin 22, inv(Request) = 0 50 3 if(timeOut) 51 3 { 52 4 *led = 0x7B; //9 53 4 // reset FPGA; 54 4 } 55 3 // state = DETECTING_USER; C51 COMPILER V6.00 FPGA 05/30/2001 17:04:13 PAGE 2 56 3 runFPGA = 0; 57 3 } 58 2 } 59 1 while(1) {} 60 1 }/* end FPGA_Task */ 61 void FPGA_Timer0_Handler() { 62 1 TL0 = TL0 + FPGA_RELOAD_LO_B ; // Load the timer high and low bytes 63 1 TH0 = FPGA_RELOAD_HI_B; 64 1 subseconds = subseconds + 1; 65 1 66 1 if (subseconds == 100) { // and check for one/tenth-second rollover 67 2 subseconds = 0; 68 2 seconds = seconds + 1; 69 2 if(seconds == 4) 70 2 { 71 3 timeOut = 1; 72 3 seconds = 0; 73 3 } 74 2 } 75 1 } /* end of FPGA_Timer0_Handler() */ 76 77 void FPGA_Ext1_Handler() { 78 1 //*led = 0x5D; //2 79 1 done = 1; 80 1 IE0 = 0; 81 1 } /* end of FPGA_Ext1_Handler() */ 82 83 /* 84 case 0: value = 0x77; init =1; break; 85 case 1: value = 0x12; break; 86 case 2: value = 0x5D; break; 87 case 3: value = 0x5B; break; 88 case 4: value = 0x3A; break; 89 case 5: value = 0x6B; break; 90 case 6: value = 0x6F; break; 91 case 7: value = 0x52; break; 92 case 8: value = 0xFF; break; 93 default: value = 0x7B; 94 */ 95 96 97 98 99 100 101 102 MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 120 ---- CONSTANT SIZE = ---- ---- XDATA SIZE = ---- ---- PDATA SIZE = ---- ---- DATA SIZE = 4 ---- IDATA SIZE = ---- ---- BIT SIZE = 3 ---- END OF MODULE INFORMATION. C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)