请问Receivekvdata是没进入中断一次就接收一个数据,还是接收一个数组?假如要接收一组数,40H 30H 30H 31H 32H,
每一次中断是接收完这组数
还是一个一个的接收,要多次中断才能接收完?
/******************************************/
//程序名:串口发送数据
//函数:接收和发送数据。
//版本:1.2
//出处:ANC 2017.8.10
/******************************************/
#include <STC89C5xRC.H>
#include"intrins.h"
#include "kv.h"
#include "se1.h"
#define FOSC 11059200L //System frequency
#define BAUD 9600 //UART baudrate
bit busy;
bit reok;
extern BYTE ReceiveKvData[18];
BYTE i;
void se1_init()
{
SCON = 0x50; //8-bit variable UART
TMOD = 0x20; //Set Timer1 as 8-bit auto reload mode
TH1 = TL1 = -(FOSC/12/32/BAUD); //Set auto-reload vaule
TR1 = 1; //Timer1 start run
ES = 1; //Enable UART interrupt
EA = 1; //Open master interrupt switch
}
void Uart_Isr() interrupt 4 using 1
{
if (RI)
{
RI = 0; //Clear receive interrupt flag
ReceiveKvData[i] = SBUF; //P0 show UART data
i++;
if(SBUF==0x0d)
{
i=0;
reok=1;
}
if(i==17)
i=0;
}
if (TI)
{
TI = 0; //Clear transmit interrupt flag
busy = 0; //Clear transmit busy flag
}
}
|