📄 serial.c
字号:
//-----------------------------------------------------------------------------
// Net SERIAL.C
//
// This module handles RS-232 messages and associated tasks
//-----------------------------------------------------------------------------
#include <reg52.h>
#include <intrins.h>
#include "net.h"
#include "serial.h"
void init_serial(void)
{
// ClearCommRecBuffer();
// OpenComm();
}
//------------------------------------------------------------------------
// This function converts an integer to an ASCII string. It is a
// normally provided as a standard library function but the Keil
// libraries do not include it. Caution: The string passed to this
// must be at least 12 bytes long
//------------------------------------------------------------------------
char * itoa(UINT value, char * buf, UCHAR radix)
{
UINT i;
char * ptr;
char * temphold;
temphold = buf;
ptr = buf + 12;
*--ptr = 0; // Insert NULL char
do
{
// First create string in reverse order
i = (value % radix) + 0x30;
if(i > 0x39) i += 7;
*--ptr = i;
value = value / radix;
} while(value != 0);
// Next, move the string 6 places to the left
// Include NULL character
for( ; (*buf++ = *ptr++); );
return(temphold);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -