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

📄 main.c

📁 embedded ethernet code for pic18F
💻 C
字号:
#include <p18cxxx.h>
#include <usart.h>
#include "nic.h"
#include "addresses.h"
#include "connections.h"
#include "sockets.h"
#include "network.h"

#pragma config OSC = HS, OSCS = OFF
#pragma config PWRT = ON, BOR = ON, BORV = 27
#pragma config WDT = OFF, WDTPS = 128
#pragma config CCP2MUX = OFF
#pragma config STVR = OFF, LVP = OFF, DEBUG = OFF
#pragma config CP0 = OFF, CP1 = OFF, CP2 = OFF, CP3 = OFF
#pragma config CPB = OFF, CPD = OFF
#pragma config WRT0 = OFF, WRT1 = OFF, WRT2 = OFF, WRT3 = OFF
#pragma config WRTB = OFF, WRTD = OFF
#pragma config EBTR0 = OFF, EBTR1 = OFF, EBTR2 = OFF, EBTR3 = OFF
#pragma config EBTRB = OFF

unsigned char packet[512];

void main(void)
{
   
   
   OpenUSART(USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH,21); // 57600 bauds
   
   //initialiseSockets();
   initSocketInfo();
   
   
   initNetworkLayer(MyMAC,MyIP,subnetMask);
   //initNIC(MYMAC);
   
//******************************************************************
//*	MAIN SERVICE LOOP
//******************************************************************
   while(1)
   {
	   ClrWdt();
	   if(dataToRead()) handleIncomingPacket(packet);
	   ClrWdt();
	   handleOutgoingPacket(packet);
   }
}

⌨️ 快捷键说明

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