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

📄 serial.c

📁 一个小的嵌入式os
💻 C
字号:
#include "44b0x.h"
#include "gps_head.h"
#include "Cn_oS_head.h"
#include "test.h"
extern void ENTER_CRITICAL(void);
extern void EXIT_CRITICAL(void);

struct uart
{
int a;
int b;
int c;
int d;
}uart0,uart1;

//==================================
char  uart_getc()
{ 
char c;

while((UTRSTAT1& 0x01));
	c=URXH0; 
	return c;	
}

//==================================
void uart_putc(char c)
{ 
	while(!(UTRSTAT0 & 0x02));
	UTXH0 = c;
	
	//TimeDelay(500);
}

//==================================

void uart_put_string(char *p)
{ 

#if NO_UART > 0
int a;
a=a;
#else
 //ENTER_CRITICAL();
	while(*p)
		uart_putc(*p++);
	//EXIT_CRITICAL();
#endif
	
}

void uart_put_string_gps(char *p)
{ 
	if(gps_flag_temp==1)
		{
	while(*p)
		uart_putc(*p++);	
		uart_putc('\n');
	gps_flag_temp=0; 							//this sentence to tell the UART interrupt serive function that: 
			}									//the main function has read a whole frame,you can go on to write the frame to gps

	
}






⌨️ 快捷键说明

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