sci.c

来自「contain many examples code for I2c,UART,」· C语言 代码 · 共 49 行

C
49
字号
//#include <pic.h>
#include "sci.h"

/* Routines for initialisation and use of the SCI
 * for the PIC processor.
 */

/* other options:
 * frame errors
 */
#if 0
void
sci_Init(void)
{
	
	BRGH = 1;	/* high baud rate */
	SPBRG = 51;	/* set the baud rate */
	RCSTA=0x90;
	//RCSTA=0x80;
	TXSTA =0x24;
	//SYNC=1;
	
}
#endif

void
sci_PutByte(unsigned char byte)
{
	while(!TXIF)	/* set when register is empty */
		continue;
	TXREG = byte;
 	asm("clrwdt");
	return;
}


void putst(register const char *str)
{
	while((*str)!=0)	{
		sci_PutByte(*str);
	    	if (*str==13) sci_PutByte(10); 
    		if (*str==10) sci_PutByte(13);
		str++;		
	}
}



⌨️ 快捷键说明

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