📄 com.c
字号:
#include "Com.h"
#include "AS1.h"
#include "IO_Map.h"
/*******************************************************************
* Transmit char (ASCII) subroutine
* Description : Transmit ascii via RS232
* :
* Example : N/A
* Input : data
* Output : single ascii to screen
* Modify : N/A
* Return : N/A
********************************************************************/
void tx_char0(char data)
{
while ((SCISR1&0x40)!=0x40);
SCIDRL = data;
}
/*******************************************************************
* printf0 subroutine
* Description : Transmit string via RS232
* :
* Example : N/A
* Input : *str
* Output : ascii to screen without lf and cr at the end
* Modify : N/A
* Return : N/A
********************************************************************/
void printf0(char *str)
{
while((*str != '\r'))
{
tx_char0(*str);
if(*str++=='\n')
tx_char0('\r');
}
}
/*******************************************************************
* Transmit out 1 char (ASCII) subroutine
* Description : Transmit out upper and lower 4 bit of char as ascii
* : via RS232
* :
* Example : 0x32
* Input : 0x32 (cdata)
* Output : 3 2 (ascii)
* Modify : N/A
* Return : void
********************************************************************/
void send_asc(char cdata)
{
if(cdata>9)
tx_char0(cdata+'0'+7);
else
tx_char0(cdata+'0');
}
/*******************************************************************
* Convert HEX to ASCII subroutine
* Description : Convert hex to ascii and send out via RS232
* :
* Example : 0x32
* Input : 0x32 (cdata)
* Output : 3 2 (ascii)
* Modify : N/A
* Return : void
********************************************************************/
void hex_asc(char cdata)
{
send_asc((cdata>>4)&0x0f);
send_asc((cdata)&0x0f);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -