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

📄 flowctrl.c

📁 用MCS51 单片机的TCIP协议的测试,很基本的程序,对新手可能有帮助!
💻 C
字号:
/*
********************************************************************************
* Wiznet.
* 5F Simmtech Bldg., 228-3, Nonhyun-dong, Kangnam-gu,
* Seoul, Korea
*
* (c) Copyright 2002, Wiznet, Seoul, Korea
*
* Filename      : flowctrl.c
* Programmer(s) : 
* Version       : 1.0 
* Created       : 2003/03/05
* Modified      :
* Description   : 
********************************************************************************
*/
#include "config.h"
#include "serial.h"
#include "flowctrl.h"

/*
********************************************************************************
* Description : Flow control Xon-Off
* Arguments   : None
* Returns     : None
* Note        : 
********************************************************************************
*/
u_char Check_XonOff(u_char buf_full_flag, u_int sdata)
{
	if (buf_full_flag == 0) {
		if (sdata > XOFF_THRESH) {
			EA = 0;
			  PutByte(XOFF);
			EA = 1;
		    return(1); // buffer full
		}
	}else {
		if (sdata < XON_THRESH) {
			EA = 0;
				PutByte(XON);
			EA = 1;
		    return(0); // buffer is not full
		}
	}
	
}

/*
********************************************************************************
* Description : 
* Arguments   : None
* Returns     : None
* Note        : 
********************************************************************************
*/
void Loopback_CTS(void)
{
	u_char temp;
	
	temp = P1 & 0x80; //read CTS
	if (temp == 0x80) {
		P1 |= RTS_H;
	}
	else if (temp == 0x00) {
		P1 &= RTS_L;
	}
}

/*
********************************************************************************
* Description : 
* Arguments   : None
* Returns     : None
* Note        : 
********************************************************************************
*/
u_char Check_RRTS(void)
{
	u_char temp;
	
	EA = 0;
		temp = P1 & 0xff;
	EA = 1;
	
	if ((temp & CTS_H) == 0x80) {
		// CTS is high => R RTS is Low : Stop Sending
		return(1);
	}
	else if ((temp & CTS_H) == 0x00) {
		// CTS is low => R RTS is High : Keep Sending
		return(0);
	}
}

⌨️ 快捷键说明

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