main.c

来自「PIC单片机的一些资料 学习单片机的朋友欢迎下载一定有用的哦」· C语言 代码 · 共 29 行

C
29
字号
/*********************************************
 example program for PIC download board
 16F877A @3.6864MHz
 test usart
 www.mcufan.com
*********************************************/
#include <stdio.h>
#include <pic.h>
#include "usart.h"
__CONFIG(WDTDIS & HS & LVPDIS & DEBUGDIS);
/* A simple demonstration of serial communications which
 * incorporates the on-board hardware USART of the Microchip
 * PIC16Fxxx series of devices. */

void main(void){
	unsigned char input;

	INTCON=0;	// purpose of disabling the interrupts.

	init_comms();	// set up the USART - settings defined in usart.h

	// Output a message to prompt the user for a keypress	
	printf("\rwww.mcufan.com PIC download board Press a key and I will echo it back:\n");
	while(1){
		input = getch();	// read a response from the user
		printf("\rI detected [%c]",input);	// echo it back
	}
}

⌨️ 快捷键说明

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