serial_h.h

来自「8051带32Mflash的源代码」· C头文件 代码 · 共 53 行

H
53
字号
#include <reg52.h>
sfr AUXR = 0x8e;

#define uint unsigned int
#define ulong unsigned long int
#define uchar unsigned char


#define TBUF_SIZE 256
#define RBUF_SIZE 132


static xdata uchar send_ok_flag;
static xdata uchar receive_ok_flag;
xdata uchar tbuf[TBUF_SIZE];
uchar xdata rbuf[RBUF_SIZE];
static xdata uchar t_in;
static xdata uchar t_out;
static xdata uchar r_in;
static xdata uchar r_out;
uchar r_c;
uchar t_c;
uchar t_disable;
uchar xmodem_flag;
uint xomdem_count;

#define SOH 0x01
#define EOT 0x04
#define ACK 0x06
#define NAK 0x15
#define CRC 0x43
#define DLE 0x10
#define XON 0x11
#define XOF 0x13
#define SYN 0x16
#define CAN 0x18

static xdata uchar r_xmodem[132];


void putword(uint value);
uint getword(void);
void xmodem_receive(void);
uchar xdata *getxmodem(void);
uchar getchar1(uint value);

/*----------------------------------------------------------------
		DELAY program 	
-----------------------------------------------------------------*/
extern void delay5us(uint utimes);    //5uS*utimes  IN 12MHZ
extern void delay10ms(uint mtimes); //10MS*mtimes  IN 12MHZ
extern void delay1s(uint time1,uint time2);

⌨️ 快捷键说明

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