Professional Documents
Culture Documents
195508359-Config-TCPIP Stack PDF
195508359-Config-TCPIP Stack PDF
195508359-Config-TCPIP Stack PDF
#if STACK_USE_CCS_PICENS
#define STACK_USE_MCPENC 1
#endif
#if STACK_USE_CCS_PICEEC
#define STACK_USE_MCPINC 1
#endif
//network gateway
MY_GATE_BYTE1=192;
MY_GATE_BYTE2=168;
MY_GATE_BYTE3=100;
MY_GATE_BYTE4=1;
//subnet mask
MY_MASK_BYTE1=255;
MY_MASK_BYTE2=255;
MY_MASK_BYTE3=255;
MY_MASK_BYTE4=0;
}
char ExampleIPDatagram[] = {
0x45, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
0x64, 0x11, 0x2A, 0x9D, 0x0A, 0x0B, 0x0C, 0x0D,
0x0A, 0x0B, 0x0C, 0x0E
};
char ExampleUDPPacket[] = {
0x04, 0x00, 0x04, 0x01, 0x00, 0x08, 0x00, 0x00,
0x01, 0x02, 0x03, 0x04
};
+ Bc 2 : cu hnh li cc chn giao tip SPI vi ENC28J60. cu
hnh li cc chn ny cc bn vo file ENC288J60.c v file hardware.h . V
y l on cn chnh sa.
#define PIN_ENC_MAC_SO PIN_B0 // Khi SPI ca VDK ca bn
#define PIN_ENC_MAC_SI PIN_C7 //
#define PIN_ENC_MAC_CLK PIN_B1 //
#define PIN_ENC_MAC_CS PIN_D1
#define PIN_ENC_MAC_RST PIN_D0
#define PIN_ENC_MAC_INT PIN_B2
#define PIN_ENC_MAC_WOL PIN_B3
void mac_enc_spi_tris_init()
{set_tris_c(0b01111111);set_tris_b(0b11111101);set_tris_d(0b11111100);}
// Set output,input cho cc chn tng ng ca khi SPI.
_ Cc bn thay #define mac_enc_spi_tris_init() bng void
mac_enc_spi_tris_init()
+ Bc 3: Khi mun thm 1 giao thc no vo chng trnh th cc
bn nh ngha giao thc u hm main:
#define STACK_USE_ICMP 1
#define STACK_USE_ARP 1
#define STACK_USE_TCP 1
#include ccstcpip.h