⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 阿根廷教授编写的嵌入式internet的实验教程的高质量代码
💻 C
字号:
/******************************************************************************************
   main.c (v1.0)
-------------------------------------------------------------------------------------
This code is from the book:
"Embedded Internet: TCP/IP Basics, Implementation and Applications" by Sergio Scaglia
[Pearson Education, 2006 - ISBN: 0-32-130638-4]

This code is copyright (c) 2006 by Sergio Scaglia, and it may only be used for educational
purposes.  For commercial use, please contact me at sscaglia@intramarket.com.ar
For more information and updates, please visit www.embeddedinternet.org
******************************************************************************************/

#include "Timer.h"
#include "Uart.h"
#include "Led.h"
#include "RTC.h"
#include "ADC.h"
#include "console.h"
#include "app.h"
#include "Stack.h"
#include <iolpc2129.h>
#include <stdio.h>

void CPUinit(void)
{
  PLLCFG_bit.MSEL=3;    //See PLL calculations in #define section at top of this file
  PLLCFG_bit.PSEL=1;    //See PLL calculations in #define section at top of this file
  PLLFEED=0xAA;
  PLLFEED=0x55;
  PLLCON_bit.PLLE=1;                 // Enable the PLL
  PLLFEED=0xAA;
  PLLFEED=0x55;
  while(!(PLLSTAT & 0x0400));  // Wait for PLL to lock

  //Init MAM & Flash memory fetch
  MAMCR_bit.MODECTRL=2;
  MAMTIM_bit.CYCLES=4;
  VPBDIV_bit.VPBDIV=0;   //See PLL calculations in #define section at top of this file
}


void main (void) {

   CPUinit();
  __disable_interrupt();
  INTERRUPTSinit();
  __enable_interrupt();

  UART_init(9600);
  printf("\nUART Initialized\n");
  timer_init();
  printf("TIMER Initialized\n");
  led_init();
  printf("LED Initialized\n");
  RTC_init();
  printf("RTC Initialized\n");
  ADC_init();
  printf("ADC Initialized\n");
  app_init();
  printf("Application Initialized\n");

  stack_init();
  printf("TCP/IP Stack Initialized\n\n");

  printf("\r\nLab 3: The ARP Protocol\r\n");
  printf("Press h to see the Console Commands help...\r\n");


  while (1) {
    stack_process();
    led_process();
    console_process();
    app_process();
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -