View Single Post
Old 02-12-2011, 11:48 PM   #1
ThanhPhong1991
Nhập môn đệ tử
 
Tham gia ngày: Oct 2011
Bài gửi: 6
:
Code điều khiển thiết bị qua internet

Chương trình chính
////////////////////////////////////////////////////
#define THIS_IS_STACK_APPLICATION
#include "TCPIP Stack/TCPIP.h"
#include "MainDemo.h"
APP_CONFIG AppConfig;
BYTE AN0String[8];
#if defined(EXPLORER_16)
int __C30_UART = 2;
#endif
static void InitAppConfig(void);
static void InitializeBoard(void);
static void ProcessIO(void);
#if defined(__18CXX)
#if defined(HI_TECH_C)
void interrupt low_priority LowISR(void)
#else
#pragma interruptlow LowISR
void LowISR(void)
#endif
{
TickUpdate();
}
{
#if defined(ZG_CS_TRIS) zgEintISR();
#endif // ZG_CS_TRIS
}
#if defined(__18CXX)
void main(void)
#else
int main(void)
#endif
{
static TICK t = 0;
static DWORD dwLastIP = 0;
InitializeBoard();
TickInit();
#if defined(STACK_USE_MPFS) || defined(STACK_USE_MPFS2)
MPFSInit();
#endif
InitAppConfig();
if(BUTTON0_IO == 0u)
{
#if defined(EEPROM_CS_TRIS) ||
defined(SPIFLASH_CS_TRIS)
TICK StartTime = TickGet();
LED_PUT(0x00);
}
StackInit();
while(1)
{
if(TickGet() - t >= TICK_SECOND/2ul)
{
t = TickGet();
LED0_IO ^= 1;
}
StackTask();
StackApplications();
#if defined(STACK_USE_GENERIC_TCP_CLIENT_EXAMPLE)
GenericTCPClient();
#endif
#if defined(STACK_USE_GENERIC_TCP_SERVER_EXAMPLE)
GenericTCPServer();
#endif
#if defined(STACK_USE_SMTP_CLIENT)
SMTPDemo();
#endif
#if defined(STACK_USE_ICMP_CLIENT)
PingDemo();
#endif
#if defined(STACK_USE_SNMP_SERVER) && !defined(SNMP_TRAP_DISABLED)
SNMPTrapDemo();
if(gSendTrapFlag)
SNMPSendTrap();
#endif
ProcessIO();
if(dwLastIP != AppConfig.MyIPAddr.Val)
{
dwLastIP = AppConfig.MyIPAddr.Val;
#if defined(STACK_USE_UART)
putrsUART((ROM char*)"\r\nNew IP Address: ");
#endif
DisplayIPValue(AppConfig.MyIPAddr);
#if defined(STACK_USE_UART)
putrsUART((ROM char*)"\r\n");
#endif
#if defined(STACK_USE_ANNOUNCE)
AnnounceIP();
#endif
}
}
}

static void InitializeBoard(void)
{
// LEDs
LED0_TRIS = 0;
LED1_TRIS = 0;
LED2_TRIS = 0;
LED3_TRIS = 0;
LED4_TRIS = 0;
LED5_TRIS = 0;
LED6_TRIS = 0;
#if !defined(EXPLORER_16)
LED7_TRIS = 0;
#endif

Anh chị có ai hiểu đoạn code này xin giải thích giúp em với. Thanks các anh chị trước
ThanhPhong1991 vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn