fork download
  1. #define IntTime0 (10000)
  2.  
  3. #define ValueTH0 ((65536-IntTime0)>>8)
  4.  
  5. #define ValueTL0 ((65536-IntTime0) & 0x00FF)
  6.  
  7. #define IntTime1 (50000)
  8.  
  9. #define ValueTH1 ((65536-IntTime1)>>8)
  10.  
  11. #define ValueTL1 ((65536-IntTime1) & 0x00FF)
  12.  
  13. #define ClkCount (20)
  14.  
  15. #include <reg51.h>
  16.  
  17.  
  18.  
  19. void Delay10ms(int count);
  20.  
  21. const unsigned char code Seg7[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x27,0x7F,0x67,0x3F,0x00,0x40};
  22.  
  23. const unsigned char code ScanLine[]={0x01,0x02,0x04,0x08};
  24.  
  25.  
  26.  
  27. char HrNum=0,MinNum=0;
  28.  
  29. char DigitNum[4]={0,0,0,0};
  30.  
  31.  
  32.  
  33. void main (void)
  34.  
  35. {
  36.  
  37. unsigned char i=0x01;
  38.  
  39. IE=0x8A;
  40.  
  41. TMOD=0x11;
  42.  
  43. TH0=ValueTH0; TL0=ValueTL0;
  44.  
  45. TH1=ValueTH1; TL1=ValueTL1;
  46.  
  47. TCON &= 0x5F;
  48.  
  49. TCON |= 0x50;
  50.  
  51.  
  52.  
  53. while (1)
  54.  
  55. {
  56.  
  57. i= (i<<1 | i>>7);
  58.  
  59. P0 =~ i;
  60.  
  61. Delay10ms(50);
  62.  
  63. }
  64.  
  65. return;
  66.  
  67. }
  68.  
  69.  
  70.  
  71. void T0IntDisplay(void) interrupt 1
  72.  
  73. {
  74.  
  75. static char PosN=0;
  76.  
  77. TH0=ValueTH0; TL0=ValueTL0;
  78.  
  79. TF0=0;
  80.  
  81. TR0=1;
  82.  
  83.  
  84.  
  85. P1=ScanLine[PosN];
  86.  
  87. P2=*(Seg7+DigitNum[PosN]);
  88.  
  89. PosN++;
  90.  
  91. PosN &= 0x03;
  92.  
  93. }
  94.  
  95.  
  96.  
  97. void T1Int(void) interrupt 3
  98.  
  99. {
  100.  
  101. static char RptCount=ClkCount;
  102.  
  103. TH1=ValueTH1; TL1=ValueTL1;
  104.  
  105. TF1=0;
  106.  
  107. TR1=1;
  108.  
  109.  
  110.  
  111. RptCount--;
  112.  
  113. if(RptCount !=0)
  114.  
  115. return;
  116.  
  117. else
  118.  
  119. {
  120.  
  121. RptCount=ClkCount;
  122.  
  123. DigitNum[0]++;
  124.  
  125. if(DigitNum[0]==10)
  126.  
  127. {
  128.  
  129. DigitNum[0]=0;
  130.  
  131. DigitNum[1]++;
  132.  
  133. if(DigitNum[1]==6)
  134.  
  135. {
  136.  
  137. DigitNum[1]=0;
  138.  
  139. DigitNum[2]++;
  140.  
  141. if(DigitNum[2]==4 && DigitNum[3]==2)
  142.  
  143. {
  144.  
  145. DigitNum[2]=0;
  146.  
  147. DigitNum[3]=0;
  148.  
  149. }
  150.  
  151. if(DigitNum[2]==10)
  152.  
  153. {
  154.  
  155. DigitNum[2]=0;
  156.  
  157. DigitNum[3]++;
  158.  
  159. }
  160.  
  161. }
  162.  
  163. }
  164.  
  165. }
  166.  
  167. }
  168.  
  169.  
  170.  
  171. void Delay10ms(int count)
  172.  
  173. {
  174.  
  175. int i,j;
  176.  
  177. for (i=0;i<count;i++)
  178.  
  179. for(j=0;j<1940;j++)
  180.  
  181. ;
  182.  
  183. return;
  184.  
  185. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(2,0): error CS1025: Single-line comment or end-of-line expected
prog.cs(4,0): error CS1025: Single-line comment or end-of-line expected
prog.cs(6,0): error CS1025: Single-line comment or end-of-line expected
prog.cs(8,0): error CS1025: Single-line comment or end-of-line expected
prog.cs(10,0): error CS1025: Single-line comment or end-of-line expected
prog.cs(12,0): error CS1025: Single-line comment or end-of-line expected
prog.cs(14,0): error CS1025: Single-line comment or end-of-line expected
prog.cs(16,0): error CS1024: Wrong preprocessor directive
prog.cs(19,0): error CS1525: Unexpected symbol `void'
prog.cs(21,30): warning CS0658: `]' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(185,1): error CS8025: Parsing error
Compilation failed: 10 error(s), 1 warnings
stdout
Standard output is empty