Lo stack TCP/IP per la scheda FLEX

Lo stack TCP/IP per la scheda FLEX: Questo software implementa uno stack TCP/IP utilizzabile con la scheda FLEX e permette la comunicazione con la scheda verso un cavo ethernet, utilizzando una varietà di protocolli.

Ecco alcuni dei protocolli inclusi nella demo: DHCP (Dynamic Host Configuration Protocol), FTP (File Transfer Protocol), HTTP (Hypertext Transfer Protocol), SMTP (Simple Mail Transfer Protocol), SNMP (Simple Network Management Protocol), Secure NTP (Network Time Protocol), Telnet.
La demo e' stata realizzata adeguando lo stack TCP/IP (la versione 4.18) della Microchip Technology Inc. e le relative application notes.

Questa è la lista dei componenti hardware necessari per utilizzare la demo:
* FLEX board (light o full)
* FLEX Multics daugtherboard
* FLEX Ethernet plug-in module
* FLEX RS232 plug-in module (facoltativo)

Lo stack TCP/IP per la scheda FLEX - codice

//
// PIC18 Interrupt Service Routines
//
// NOTE: Several PICs, including the PIC18F4620 revision A3 have a RETFIE FAST/MOVFF bug
// The interruptlow keyword is used to work around the bug when using C18
#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(HI_TECH_C)
void interrupt HighISR(void)
#else
#pragma interruptlow HighISR
void HighISR(void)
#endif
{
#if defined(STACK_USE_UART2TCP_BRIDGE)
UART2TCPBridgeISR();
#endif
}

#if !defined(HI_TECH_C)
#pragma code lowVector=0x18
void LowVector(void){_asm goto LowISR _endasm}
#pragma code highVector=0x8
void HighVector(void){_asm goto HighISR _endasm}
#pragma code // Return to default code section
#endif

#elif defined(__C30__)
// void _ISR _AddressError(void)
// {
// Nop();
// Nop();
// Nop();
// }

#endif // End of PIC18 ISRs

//
// Main application entry point.
//
#ifdef __C30__
int main(void)
#else
void main(void)
#endif
{
static TICK t = 0;
BYTE i;

// Initialize any application specific hardware.
InitializeBoard();

#ifdef USE_LCD
// Initialize and display the stack version on the LCD
LCDInit();
for(i = 0; i < 100; i++) DelayMs(1); strcpypgm2ram((char*)LCDText, "TCPStack " VERSION " " " "); LCDUpdate(); #endif // Initialize all stack related components. // Following steps must be performed for all applications using // the Microchip TCP/IP Stack. TickInit(); #if defined(STACK_USE_MPFS) || defined(STACK_USE_MPFS2) // Initialize Microchip File System module MPFSInit(); #endif // Initialize Stack and application related NV variables into AppConfig. InitAppConfig(); // Initiates board setup process if button is depressed // on startup // --- Changed for Flex board --- // --- Set to 1 to enable config menù on UART --- //if(BUTTON0_IO == 0u) if (0) { #if defined(MPFS_USE_EEPROM) && (defined(STACK_USE_MPFS) || defined(STACK_USE_MPFS2)) // Invalidate the EEPROM contents if BUTTON0 is held down for more than 4 seconds TICK StartTime = TickGet(); while(BUTTON0_IO == 0u) { if(TickGet() - StartTime > 4*TICK_SECOND)
{
XEEBeginWrite(0x0000);
XEEWrite(0xFF);
XEEEndWrite();
#if defined(STACK_USE_UART)
putrsUART("\r\n\r\nBUTTON0 held for more than 4 seconds. EEPROM contents erased.\r\n\r\n");
#endif
LED0_TRIS = 0;
LED1_TRIS = 0;
LED2_TRIS = 0;
LED3_TRIS = 0;
LED0_IO = 1;
LED1_IO = 1;
LED2_IO = 1;
LED3_IO = 1;
while((LONG)(TickGet() - StartTime) <= (LONG)(9*TICK_SECOND/2)); Reset(); break; } } #endif #if defined(STACK_USE_UART) SetConfig(); #endif }

Per maggiori informazioni clicca qui.

Repost: 26 Giu 2008

Scarica subito una copia gratis

Scrivi un commento

Seguici anche sul tuo Social Network preferito!

Send this to a friend