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

📄 serial.c

📁 用8051采用pwm方式播放 串口语音数据
💻 C
字号:
/***************************************************************\
name         : serial.c
desctiption  : this file is used for serial port
author       : coolfire
update       : 6/17/07
/***************************************************************/
//includes
#include "serial.h"

//global Variables

Uchar pf;

/***************************************************************\
name           : init()
desctiption    : initialise the serial port
in Parameters  : no
out Parameters : no 
/***************************************************************/
void serial_init()
{
  TMOD=0x20;
  TH1 =0xe8;
  TL1 =0xe8;
  PCON=0x80;
  TR1 =1;
  SCON=0x50;
}

/***************************************************************\
name           : init()
desctiption    : tranfer data to serial port
in Parameters  : no
out Parameters : no 
/***************************************************************/
/*
void serial_send(Uchar idata *d)
{
  Uchar i;

  SBUF=d[i];
  pf+=d[i];
  while(TI==0);
  TI=0;

}  
*/
/***************************************************************\
name           : serial_receive()
desctiption    : receive data from serial port
in Parameters  : no
out Parameters : no 
/***************************************************************/
void serial_receive(Uchar idata *d)
{
  Uchar i;

	while(RI==0);
	RI=0;
    d[i]=SBUF;
	//pf+=d[i];

}

⌨️ 快捷键说明

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