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

📄 backup main.c

📁 本代码为SPI/I2C转双串口驱动程序。开发环境为Keil c51.
💻 C
字号:
#include "reg51.h"
#include "SC16IS752.h"
#include "VI2C_C51.h"

void main()
{

//------------------------------------------------------

	WriteToRegister(LCR,ChannelB,0x80);
	WriteToRegister(DLL,ChannelB,0x06);			//57600bps
	WriteToRegister(DLH,ChannelB,0x00);

//-------------------------------------------------------
//irDA Init
//-------------------------------------------------------
//	WriteToRegister(LCR,ChannelB,0xBF);			//Enter enhance mode
//	WriteToRegister(EFR,ChannelB,0x10);			//Enable irDA

	WriteToRegister(LCR,ChannelB,0x03);			//8 bit,no parity,1 stop bits
	WriteToRegister(FCR,ChannelB,0x07);			//enable ,reset FIFO
//	WriteToRegister(MCR,ChannelB,0x43);	

//--------------------------------------------------------
	while(1)
	{
		WriteToRegister(THR,ChannelB,0x03);
		WriteToRegister(THR,ChannelB,0xFA);
//		temp=ReadData(LSR,ChannelB);
//		if(temp&0x01)
//		{
//			temp=ReadData(RHR,ChannelB);
//			P2=temp;
//		}
//		WriteToRegister(THR,ChannelB,0x15);
//		ReadFromRegister(RHR,ChannelB,temp,10);
	}
}

//	WriteToRegister(MCR,ChannelB,0x10);
//	while( ReadData(LSR,ChannelB)&0x01 )
//	{
//		temp=	ReadData(RHR,ChannelB);
//	}
//	WriteToRegister(IER,ChannelB,0x00);

⌨️ 快捷键说明

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