📄 menu_operation.lst
字号:
C51 COMPILER V7.06 MENU_OPERATION 08/22/2004 21:22:03 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE MENU_OPERATION
OBJECT MODULE PLACED IN MENU_OPERATION.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE MENU_OPERATION.c LARGE OPTIMIZE(7,SIZE) MODA2 DEBUG OBJECTEXTEND
stmt level source
1 //---------------------------------------------------------------------------
2 // Project Title : Armature resistance tester for stator.
3 // Project No. :
4 // Project Ver. : 1.00
5 // File Name : MENU_OPERATION.c
6 // Revision : 1.00
7 // Initial Date : 22-Oct,2002
8 // Modify Date : 09-Dec,2003
9 // Description :
10 #include <..\atmel\at89s53.h>
11 #include <dom12a.h>
12 #include <absacc.h>
13 #include <stdio.h>
14
15 //extern variables
16 //extern UART_st uart;
17 extern uUART_protocol uart;
18 extern uUART_protocol uartIn;
19
20 extern struct systempara syspara;
21 extern uchar data keySTAGE[];
22 //external func.
23 extern void msDelay(unsigned int timer_count);
24 extern void Enable_Timer(char timer_name, unsigned int timer_count);
25 extern void Disable_Timer(char timer_name);
26 extern uchar STimerStillCounting(uchar idxStimer);
27
28 extern char _uart_command (unsigned char cmdcode);
29 extern char _uart_reply (void);
30
31 extern void _lcdCursorGoto(char r, char c);
32
33 uchar Menu_Operation(void);
34 uchar Display_menu_bar(uchar itemindex);
35 uchar EEPROM_WRITE(uint address, uint txINT);
36 uchar EEPROM_READ(uint address, uint *rxINT);
37 uchar Update_setting(uint *setting, char *pStr, uint UL, uint LL, uchar decplaces);
38 uchar Display_new_setting(uint newval, uchar decplaces);
39 void Get_sys_para(void);
40
41 //*******************************************************
42 uchar Menu_Operation(void)
43 {
44 1 uchar menuitem = 0;
45 1 uchar retcode;
46 1
47 1 /*
48 1 uchar totalCoils;
49 1 uchar startBar;
50 1 uint totalTested;
51 1 uint totalPassed;
52 1 uint totalFailed;
53 1 uint UL;
54 1 uint LL;
55 1 uint average;
C51 COMPILER V7.06 MENU_OPERATION 08/22/2004 21:22:03 PAGE 2
56 1 uint max;
57 1 uint min;
58 1 uchar keylocking;
59 1 uchar FixtureCtrlMode;
60 1 */
61 1 _lcdCursorGoto(1, 0);
62 1 printf("Tester config: ");
63 1 _lcdCursorGoto(1, 0);
64 1 printf(" ");
65 1 Display_menu_bar(menuitem);
66 1 while (1) {
67 2 if ( keySTAGE[pbF4] == 4 ) {
68 3 menuitem = 1 - menuitem;
69 3 Display_menu_bar(menuitem);
70 3 keySTAGE[pbF4] = 0;
71 3 } // end if
72 2
73 2 if ( menuitem == 1 && keySTAGE[pbF3] == 4 ) {
74 3 keySTAGE[pbF3] = 0;
75 3 _lcdCursorGoto(1, 0);
76 3 printf(" ");
77 3 _lcdCursorGoto(2, 0);
78 3 printf(" ");
79 3 _lcdCursorGoto(3, 0);
80 3 printf("Exit menu... ");
81 3 msDelay(400);
82 3 _lcdCursorGoto(3,22);
83 3 printf("F3:MENU F4:TEST");
84 3 return(0);
85 3 } // end if
86 2
87 2 if ( menuitem ) {
88 3 if ( keySTAGE[pbF1] == 4) {
89 4 keySTAGE[pbF1] = 0;
90 4 retcode = Update_setting(&syspara.totalCoils, "TBar=", 24, 3, 0);
91 4 Display_menu_bar(menuitem);
92 4 if ( !retcode) {
93 5 EEPROM_WRITE(eeprCoil, syspara.totalCoils);
94 5 msDelay(100);
95 5
96 5 uart.st.uiParam2 = syspara.totalCoils;
97 5 uart.st.uiParam1 = syspara.startBar;
98 5 _uart_command(UART_CONFIG_SLOT);
99 5 } // end if
100 4 } else if ( keySTAGE[pbF2] == 4) {
101 4 keySTAGE[pbF2] = 0;
102 4 retcode = Update_setting(&syspara.startBar, "SBar=", 22, 1, 0);
103 4 Display_menu_bar(menuitem);
104 4 if ( !retcode) {
105 5 EEPROM_WRITE(eeprStartBar, syspara.startBar);
106 5 msDelay(100);
107 5 uart.st.uiParam2 = syspara.totalCoils;
108 5 uart.st.uiParam1 = syspara.startBar;
109 5 _uart_command(UART_CONFIG_SLOT);
110 5 } // end if
111 4 }
112 3
113 3 } else {
114 3 if ( keySTAGE[pbF1] == 4) {
115 4 keySTAGE[pbF1] = 0;
116 4 retcode = Update_setting(&syspara.UL, "UL = ", 20000, 1, 2);
117 4 Display_menu_bar(menuitem);
C51 COMPILER V7.06 MENU_OPERATION 08/22/2004 21:22:03 PAGE 3
118 4 if ( !retcode)
119 4 EEPROM_WRITE(eeprUL, syspara.UL);
120 4 } else if ( keySTAGE[pbF2] == 4) {
121 4 keySTAGE[pbF2] = 0;
122 4 retcode = Update_setting(&syspara.LL, "LL = ", 20000, 1, 2);
123 4 Display_menu_bar(menuitem);
124 4 if ( !retcode)
125 4 EEPROM_WRITE(eeprLL, syspara.LL);
126 4 } else if ( keySTAGE[pbF3] == 4) {
127 4 keySTAGE[pbF3] = 0;
128 4 retcode = Update_setting( &syspara.FixtureCtrlMode, "Mod: ", 1, 0, 0);
129 4 Display_menu_bar(menuitem);
130 4 if (!retcode) {
131 5 _lcdCursorGoto(0,21);
132 5 printf("Mode%u", syspara.FixtureCtrlMode);
133 5 EEPROM_WRITE(eeprMode, syspara.FixtureCtrlMode);
134 5 } // end if
135 4 } // end else
136 3 } // end else
137 2 } // end while
138 1
139 1 } // end func.
140
141 //***********************************************************
142 uchar Update_setting(uint *setting, char *pStr, uint UL, uint LL, uchar decplaces)
143 {
144 1 uint val = *setting;
145 1 uchar pbUpStage = 0;
146 1 uchar pbDnStage = 0;
147 1 uchar arrowkeypressed;
148 1 uint incvalue;
149 1
150 1 _lcdCursorGoto(2,0);
151 1 printf("%s ", pStr);
152 1 Display_new_setting(val, decplaces);
153 1 _lcdCursorGoto(3,0);
154 1 printf("F1:UP F2:DN F3:Cancel F4:Save");
155 1
156 1 while (1) {
157 2 if ( keySTAGE[pbF3] == 4) {
158 3 keySTAGE[pbF3] = 0;
159 3 _lcdCursorGoto(3,0);
160 3 printf("Cancel setup...\n");
161 3 msDelay(1000);
162 3 _lcdCursorGoto(2,0);
163 3 printf(" ");
164 3 return (0x01);
165 3 } else if ( keySTAGE[pbF4] == 4) {
166 3 keySTAGE[pbF4] = 0;
167 3 _lcdCursorGoto(3,0);
168 3 printf("New setup confirmed...\n");
169 3 msDelay(1000);
170 3 _lcdCursorGoto(2,0);
171 3 printf(" ");
172 3 *setting = val;
173 3 return (0x00);
174 3 } // end if
175 2
176 2 if ( keySTAGE[pbF1] == 4 ) { // pressing UP
177 3 keySTAGE[pbF1] = 0;
178 3 pbUpStage = 0;
179 3 if ( val < UL )
C51 COMPILER V7.06 MENU_OPERATION 08/22/2004 21:22:03 PAGE 4
180 3 Display_new_setting(++val, decplaces);
181 3 } else if ( keySTAGE[pbF1] == 2 ) { // continous pressing
182 3 switch ( pbUpStage ) {
183 4 case 0: Enable_Timer(1, 1500);
184 4 pbUpStage = 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -