#if 1
/*===========================================================================================
Project : UART Test
Version : LK-PIC16F18F DEV & TRAINING
Date    : 2020-08-31
Author  : Kyung Nam Lee
Company : LKEMBEDDED 
Compiler: MPLAB+Hitech-C
Comment : UART포트에서 PC쪽으로 "USB Serial Data String Using CP2102" 문자를 출력하고 있는 프로그램이다.
===========================================================================================*/
#include <pic16f877a.h>
#include <stdio.h>
#define _XTAL_FREQ 16000000
#define XTAL 16000000	// crystal frequency - 4MHz
#include <htc.h>	// Required to interface with delay routines
__CONFIG(FOSC_HS &WDTE_OFF &PWRTE_ON &CP_OFF &BOREN_OFF &LVP_OFF);	//Configuration Bits Setting in Code
#define TXD (0X01<<6)
#define RXD (0X01<<7)
void putch(unsigned char byte)
{
	/* output one byte */
	while (!TRMT)	/* set whilst TX in progress */
	continue;
	TXREG = byte;
}
void SysInit()
{
	//-- 입출력 레지스터 설정 초기화------------------
	TRISC = ((~TXD)|RXD);
	//---통신 레지스터 초기화---------------------------
	TXSTA = 0B00100000;  //--TXEN=1
	RCSTA = 0B10010000;  //--SPE=1
	SPBRG = 25;           //--16Mhz = 9600Bps
	//-----------------------------------------------------------
}

void main()
{
	SysInit();	//--- 시스템 설정 초기화 함수 
	while (1)	//---Endless Loop
	{
	printf("USB Serial Data String Using CP2102\r\n");
	}
}
#endif
