?? main.lst
字號:
-erif; font-size: 28pt; font-weight: bold;\">%d</span></center></body></html>",num_buff[3]);
224 2
225 2 // Fill the socket with data to send.
226 2 socket_ptr->send_ptr = HTML_BUFFER;
227 2 socket_ptr->send_len = strlen(HTML_BUFFER);
228 2 }
229 1
230 1 // Search for the type field and store the result in <msg_buff1>.
231 1 status1 = mn_http_find_value (BODYptr, (byte*)"b1", msg_buff1);
232 1 // Uart0SendString("KEY1\n",5);
233 1 // Check status1 and status2 to determine if msg_buff1 and msg_buff2 are valid.
234 1 if(status1){
235 2 num_buff[0]=2;
236 2 num_buff[1]=2;
237 2 LED1=1;
238 2 sprintf(HTML_BUFFER, "<html><body bgcolor=blue text=yellow><center><span style=\"font-family: sans-seri
-f; font-size: 28pt; font-weight: bold;\">%d.%d</span></center></body></html>",num_buff[0],num_buff[1]);
239 2
C51 COMPILER V8.08 MAIN 04/24/2008 18:17:35 PAGE 5
240 2 // Fill the socket with data to send.
241 2 socket_ptr->send_ptr = HTML_BUFFER;
242 2 socket_ptr->send_len = strlen(HTML_BUFFER);
243 2 }
244 1 status2 = mn_http_find_value (BODYptr, (byte*)"b2", msg_buff1);
245 1 if(status2){
246 2 num_buff[0]=3;
247 2 num_buff[1]=3;
248 2 LED1=0;
249 2 sprintf(HTML_BUFFER, "<html><body bgcolor=blue text=yellow><center><span style=\"font-family: sans-seri
-f; font-size: 28pt; font-weight: bold;\">%d.%d</span></center></body></html>",num_buff[0],num_buff[1]);
250 2
251 2 // Fill the socket with data to send.
252 2 socket_ptr->send_ptr = HTML_BUFFER;
253 2 socket_ptr->send_len = strlen(HTML_BUFFER);
254 2 }
255 1
256 1 status3 = mn_http_find_value (BODYptr, (byte*)"To", msg_buff2);
257 1 if(status3){
258 2
259 2 //sprintf(HTML_BUFFER, "<html><body bgcolor=blue text=yellow><center><span style=\"font-family: sans-ser
-if; font-size: 28pt; font-weight: bold;\">%d.%d</span></center></body></html>",num_buff[0],num_buff[1]);
260 2 sprintf(HTML_BUFFER, "<html><body bgcolor=blue text=yellow><center><span style=\"font-family: sans-s
-erif; font-size: 28pt; font-weight: bold;\">%s</span></center></body></html>",msg_buff2);
261 2 // Fill the socket with data to send.
262 2 socket_ptr->send_ptr = HTML_BUFFER;
263 2 socket_ptr->send_len = strlen(HTML_BUFFER);
264 2 }
265 1 }
266
267
268
269 //-----------------------------------------------------------------------------
270 // Initialization Routines
271 //-----------------------------------------------------------------------------
272
273 //-----------------------------------------------------------------------------
274 // PORT_Init
275 //-----------------------------------------------------------------------------
276 //
277 // Configure the Interrupts, Crossbar and GPIO ports
278 //
279 void PORT_web (void)
280 {
281 1
282 1
283 1
284 1 P0MDOUT |= 0x40; // enable UTX as push-pull output
285 1 P1MDOUT |= 0xC8; // /WR and /RD are push-pull
286 1 P2MDOUT |= 0xFF;
287 1 P3MDOUT |= 0xFF;
288 1 P4MDOUT |= 0xFF;
289 1
290 1 }
291 //-----------------------------------------------------------------------------
292 // EMIF_Init
293 //-----------------------------------------------------------------------------
294 //
295 // Configure the External Memory Interface for both on and off-chip access.
296 //
297 void EMIF_Init (void)
298 {
C51 COMPILER V8.08 MAIN 04/24/2008 18:17:35 PAGE 6
299 1
300 1 EMI0CF = 0x0B; // Multiplex mode
301 1
302 1 EMI0TC = EMIF_TIMING; // This constant may be modified
303 1 // according to SYSCLK to meet the
304 1 // timing requirements for the CP2200
305 1
306 1 EMI0CN = BASE_ADDRESS; // Page of XRAM accessed by EMIF
307 1
308 1 }
309
310 //-----------------------------------------------------------------------------
311 // SYSCLK_Init
312 //-----------------------------------------------------------------------------
313 //
314 // This routine initializes the system clock.
315 //
316 void SYSCLK_Init (void)
317 {
318 1 int i;
319 1
320 1 // OSCICN |= 0x03; // Configure internal oscillator for
321 1 // its maximum frequency
322 1
323 1 CLKMUL = 0x00; // Reset Clock Multiplier and select
324 1 // internal oscillator as input source
325 1
326 1 CLKMUL |= 0x80; // Enable the Clock Multiplier
327 1
328 1 for(i = 0; i < 256; i++); // Delay at least 5us
329 1
330 1 CLKMUL |= 0xC0; // Initialize the Clock Multiplier
331 1
332 1 while(!(CLKMUL & 0x20)); // Wait for MULRDY => 1
333 1
334 1 // RSTSRC = 0x06; // Enable missing clock detector
335 1 // and VDD monitor
336 1
337 1 FLSCL |= 0x10; // Set Flash Scale for 48MHz
338 1
339 1 // CLKSEL |= 0x03; // Select output of clock multiplier
340 1 // as the system clock.
341 1
342 1 }
343 //-----------------------------------------------------------------------------
344 // Timer2_Init
345 //-----------------------------------------------------------------------------
346 //
347 // This routine initializes Timer 2 to <T2_OVERFLOW_RATE> Hz.
348 //
349 void Timer2_Init(void)
350 {
351 1 TMR2CN = 0x00; // Stop Timer2; Use SYSCLK/12 as timebase
352 1 CKCON &= ~0x60; // Timer2 clock based on T2XCLK;
353 1
354 1 // Initialize Reload Value
355 1 TMR2RL = -(SYSCLK/12/T2_OVERFLOW_RATE);
356 1 TMR2 = TMR2RL;
357 1
358 1 ET2 = 1; // Enable Timer 2 interrupts
359 1 TR2 = 1; // Start Timer 2
360 1
C51 COMPILER V8.08 MAIN 04/24/2008 18:17:35 PAGE 7
361 1 }
362 //-----------------------------------------------------------------------------
363 // ether_reset_low
364 //-----------------------------------------------------------------------------
365 //
366 // This routine drives the reset pin of the ethernet controller low.
367 //
368 void ether_reset_low()
369 {
370 1
371 1 P0 &= ~0x40; // Pull reset low
372 1
373 1 }
374
375 //-----------------------------------------------------------------------------
376 // ether_reset_high
377 //-----------------------------------------------------------------------------
378 //
379 // This routine places the reset pin in High-Z allowing it to be pulled up
380 // using the external pull-up resistor.
381 //
382 // Additionally, this routine waits for the reset pin to read high before
383 // exiting.
384 //
385 void ether_reset_high (void)
386 {
387 1
388 1 P0 |= 0x40; // Allow /RST to rise
389 1 while(!(P0 & 0x40)); // Wait for /RST to go high
390 1
391 1
392 1 }
393
394 void DelayMs(unsigned int n)//延時(n)MS
395 {
396 1 unsigned int i;
397 1 for(;n>0;n--)
398 1 {
399 2 for(i=1200;i>0;i--);
400 2 }
401 1 }
402
403 void SysClkInit(void)//配置系統時鐘
404 {
405 1 OSCICN=0x83;
406 1 RSTSRC=0x04;
407 1 }
408
409 void SystemInit(void)//系統配置
410 {
411 1 PCA0MD&=~0x40;//禁止看門狗定時器
412 1 //EA=1;
413 1 }
414
415 void Port_Uart(void)//端口配置
416 {
417 1 P0MDIN = 0xF3;
418 1 P1MDIN = 0xDF;
419 1 P2MDIN = 0xF0;
420 1 P0MDOUT = 0x40;
421 1 P2MDOUT = 0xF0;
422 1
C51 COMPILER V8.08 MAIN 04/24/2008 18:17:35 PAGE 8
423 1 }
424 void Port_com(void)
425 { IT01CF = 0x07; // Enable Interrupt 0 on P0.7
426 1 TCON &= ~0x01; // Make /INT0 level triggered
427 1 P0SKIP = 0x0C;
428 1 P1SKIP = 0x20;
429 1 XBR0 = 0x01; // Enable UART on P0.4(TX) and P0.5(RX)
430 1 XBR1 = 0x40; // Enable crossbar and enable
431 1 // weak pull-ups
432 1
433 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1121 ----
CONSTANT SIZE = 506 ----
XDATA SIZE = 511 65
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -