📄 intt.lst
字号:
1: /*********************************************************************
2: * Filename: intt.c *
3: * Date: 10/22/2002 *
4: * Edit by Yamato View ,Goldenchip Electronic Co. ,Ltd. *
5: * *
6: * TEL: 86-0591-3375855-721 *
7: * *
8: *********************************************************************/
9: #include <pic1687x.h>
10: #include <stdio.h>
11: extern char Intdata;
12: extern char Rtcdata;
13: unsigned char Rtcsign;
14: #define PortBit(port,bit) ((unsigned)&(port)*8+(bit))
15: unsigned char Alarm_1;
16: unsigned char Alarm_2;
17: unsigned char Alarm_3;
18: unsigned char Dminutes;
19: unsigned char Dhours;
20: unsigned char MOD;
21: unsigned char Alarm_1_hour;
22: unsigned char Alarm_1_min ;
23: unsigned char Alarm_2_hour;
24: unsigned char Alarm_2_min ;
25: unsigned char Alarm_3_hour;
26: unsigned char Alarm_3_min ;
27: extern char hours,minutes,days,monthes,years;
28: extern char daysLmt;
29: extern void Line_1( void );
30: extern void Line_2( void );
31: extern void Home_Clr( void );
32: extern void Time_Disp1(void);
33: extern void Time_Disp2(void);
34: extern void Line_C6( void );
35: extern void Line_C9( void );
36: extern void Line_8C( void );
37: extern void Line_85( void );
38: extern void Line_88( void );
39: extern void Line_8A( void );
40: extern void Dayscount(void);
41: extern void Delay15Ms( void );
42: extern void Tm1_Update( void );
43:
44: void Init_Timer0(void)
45: {
46: TMR0 = 0xFF;
47: T0IE = 1;
48: INTE = 1;
49: T0IF = 0;
50: }
51:
52: void Note1( void )
53: {
54: Line_2();
55: printf("INT to Enter");
56: }
57:
58: void Note2( void )
59: {
60: Line_1();
61: printf("SetAlarm");
62: }
63:
64: void Note3( void )
65: {
66: Line_1();
67: printf("Exit Setup");
68: Line_2();
69: printf("INT to Exit ");
70: }
71:
72: void Time_Adj_S( void )
73: {
74: if (Rtcdata==4)
75: {
76: Line_C6();
77: printf(" ");
78: if (Intdata == 1)
79: hours++;
80: if(hours>23)
81: hours = 0;
82: Intdata = 0;
83: }
84: if (Rtcdata==5)
85: {
86: Line_C9();
87: printf(" ");
88: if (Intdata == 1)
89: minutes++;
90: if(minutes>59)
91: minutes = 0;
92: Intdata = 0;
93: }
94: if (Rtcdata==6)
95: {
96: Line_8C();
97: printf(" ");
98: if (Intdata == 1)
99: {
100: Rtcdata = 0;
101: Intdata = 0;
102: if (Rtcsign == 2)
103: Alarm_1 = 0;
104: if (Rtcsign == 3)
105: Alarm_2 = 0;
106: if (Rtcsign == 4)
107: Alarm_3 = 0;
108: }
109: }
110: }
111:
112: void Rtcdeal1(void)
113: {
114: Rtcdata = 1;
115: Intdata = 0;
116: while(Rtcdata>0)
117: {
118: Time_Disp1();
119: Time_Disp2();
120: Line_8C();
121: printf("Ext.");
122: if (Rtcdata==1)
123: {
124: Line_1();
125: printf(" ");
126: if (Intdata == 1)
127: years++;
128: if(years>99)
129: years = 0;
130: Intdata = 0;
131: }
132: if (Rtcdata==2)
133: {
134: Line_85();
135: printf(" ");
136: if (Intdata == 1)
137: monthes++;
138: if(monthes>12)
139: monthes = 1;
140: Intdata = 0;
141: }
142: if (Rtcdata==3)
143: {
144: Line_88();
145: printf(" ");
146: if (Intdata == 1)
147: {
148: Dayscount();
149: if(days<daysLmt)
150: days++;
151: else days = 1;
152: }
153: Intdata = 0;
154: }
155: Delay15Ms();
156: Delay15Ms();
157: Delay15Ms();
158: Time_Adj_S();
159:
160: if (Rtcdata>6) Rtcdata = 1;
161: }
162: Rtcdata = (Rtcsign+1);
163: Rtcsign = 0;
164: }
165:
166: void Rtcdeal2(void)
167: {
168: Rtcdata = 4;
169: Intdata = 0;
170: Dhours = hours;
171: Dminutes = minutes;
172: while(Rtcdata>3)
173: {
174: unsigned char Sna;
175: Sna = (Rtcsign-1);
176: Note2();
177: printf("%d",Sna);
178: Line_8A();
179: printf("Y Ext."); //159
180: Time_Disp2();
181: Delay15Ms() ;
182: Delay15Ms() ;
183: Delay15Ms() ;
184: Time_Adj_S();
185: if (Rtcdata==7)
186: {
187: Line_8A();
188: printf(" ");
189: if (Intdata == 1)
190: {
191: if (Rtcsign == 2)
192: {
193: Alarm_1 = 1;
194: Alarm_1_hour = hours;
195: Alarm_1_min = minutes;
196: }
197: if (Rtcsign == 3)
198: {
199: Alarm_2 = 1;
200: Alarm_2_hour = hours;
201: Alarm_2_min = minutes;
202:
203: }
204: if (Rtcsign == 4)
205: {
206: Alarm_3 = 1;
207: Alarm_3_hour = hours;
208: Alarm_3_min = minutes;
209: }
210: Rtcdata = 0;
211: Intdata = 0;
212: }
213: }
214: if (Rtcdata>7) Rtcdata = 4;
215: }
216: Rtcdata = (Rtcsign+1);
217: Rtcsign = 0;
218: hours = Dhours;
219: minutes = Dminutes;
220: Home_Clr();
221: }
222: void Intn(void)
223: {
224: while (Rtcdata>0)
225: {
226: Intdata = 0;
227: Home_Clr();
228: while (Rtcdata==1)
229: {
230: Line_1();
231: printf("Set Time");
232: Note1();
233: if (Intdata==1)
234: {
235: Rtcsign = 1;
236: Home_Clr();
237: Rtcdeal1();
238: }
239: }
240: while (Rtcdata==2)
241: {
242: Note2();
243: printf("1 ");
244: Note1();
245: if (Intdata==1)
246: {
247: Rtcsign = 2;
248: Home_Clr();
249: Rtcdeal2();
250: }
251: }
252: while (Rtcdata==3)
253: {
254: Note2();
255: printf("2 ");
256: Note1();
257: if (Intdata==1)
258: {
259: Rtcsign = 3;
260: Rtcdeal2();
261: Home_Clr();
262: }
263: }
264: while (Rtcdata==4)
265: {
266: Note2();
267: printf("3 ");
268: Note1();
269: if (Intdata==1)
270: {
271: Rtcsign = 4;
272: Home_Clr();
273: Rtcdeal2();
274: }
275: }
276: while (Rtcdata==5)
277: {
278: Note3();
279: if(Intdata==1)
280: {
281: Intdata = 0;
282: Rtcsign = 0;
283: Rtcdata = 0;
284: }
285: }
286: if (Rtcdata>5) Rtcdata=1;
287: }
288: }
289: void Flash(void)
290: {
291: TRISD = 0;
292: MOD=(MOD<<1);
293: if ( CARRY==1 )
294: MOD++;
295: PORTD= MOD;
296: Tm1_Update();
297: Time_Disp2();
298: }
299: void Aladisp(void)
300: {
301: unsigned char Alr_Done;
302: if(Alarm_1==1)
303: {
304: MOD = 0x0f;
305: while (hours == Alarm_2_hour&&minutes==Alarm_1_min)
306: {
307: Flash();
308: }
309: }
310: Alr_Done = 0;
311: if(Alarm_2==1)
312: {
313: MOD = 3;
314: while (hours == Alarm_2_hour&&minutes==Alarm_2_min)
315: {
316: Flash();
317: }
318: }
319: if(Alarm_3==1)
320: {
321: MOD = 0x3f;
322: while (hours == Alarm_3_hour&&minutes==Alarm_3_min)
323: {
324: Flash();
325: }
326: }
327: PORTD = 0;
328: }
329:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -