www.pudn.com > TCPmodbushy.rar > F34x_CP220.c
//-----------------------------------------------------------------------------
// F34x_Init.c
//-----------------------------------------------------------------------------
// Copyright 2006 Silicon Laboratories, Inc.
// http://www.silabs.com
//
// Program Description:
//
// Contains Initialization Routines for the F340.
//
// FID:
// Target: C8051F34x
// Tool chain: Keil C51 7.20 / Keil EVAL C51
// Silicon Laboratories IDE version 2.72
// Command Line: See Readme.txt
// Project Name: CP220x_Ethernet_Routines
//
//
//
// Release 1.0
// -Initial Release (FB)
// -30 MAY 2006
//
//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include "o:\sysdef.h"
uchar data RcvedNum;
//-----------------------------------------------------------------------------
// CP220x_RST_Low
//-----------------------------------------------------------------------------
//
// Drives the CP220x's Reset Pin Low.
//
void CP220x_RST_Low(void)
{
CP220_RST_PIN = 0; // Set P1.0 Low
}
//-----------------------------------------------------------------------------
// CP220x_RST_High
//-----------------------------------------------------------------------------
//
// Allows the CP220x's Reset Pin to be pulled up.
//
// Waits until the reset pin rises.
//
void CP220x_RST_High(void)
{
CP220_RST_PIN = 1; // Set P1.0 High
while(!CP220_RST_PIN);
}
//-----------------------------------------------------------------------------
// AB4_RST_State
//-----------------------------------------------------------------------------
//
// Returns the state of the AB4's reset pin.
//
uchar Get_RST_State(void)
{
char rst_pin_state;
rst_pin_state = CP220_RST_PIN; // Get P1.0 State
return rst_pin_state;
}
/* according to Low_level_input, when read the packet only leave the five packet, open receved! */
void INT0_ISR( void ) interrupt 0 using INT0SrvBank
{
uchar data interrupt_read;
// Net Link Status Changed
interrupt_read = INT1;
// if net cut
if( interrupt_read & LINKINT )
RSTSRC |= 0x10;
interrupt_read = INT0;
if( interrupt_read & RXINT )
{
uchar data valid_bits;
RcvedNum = 0;
valid_bits = TLBVALID;
while( valid_bits )
{
RcvedNum++;
valid_bits &= ( valid_bits - 1 );
}
if( RcvedNum >= 7 )
{
RXCN = RXINH;
#ifdef TESTDEBUG
test[2]++;
#endif
}
}
}
//-----------------------------------------------------------------------------
// End Of File
//-----------------------------------------------------------------------------