首先要了解串口通讯的根本作业原理,衔接图如下:
虚拟终端衔接:
单片机+虚拟终端(作为串口输入设备)+串口
衔接图如下:
设置如下:
单片机虚拟终端选项效果如下:
假如输入的是ASCII码,那么就不要勾选 Hex Display Mode
假如输入的是16进制,那么就不要勾选 Hex Display Mode
Clear Screen 是清屏
Echo Typed Characters 是你在虚拟终端窗口输入字符时,输入的字符显现在虚拟终端窗口上。
详细C程序如下(如有疑问联络自己,新浪微博地址:
#include
#include
#define uint unsigned int
#define uchar unsigned char
unsigned char a,flag;
char code YD[]={
0x01,0x00,0x01,0x00,0x7F,0xFC,0x03,0x80,
0x05,0x40,0x09,0x30,0x31,0x0E,0xDF,0xE4,
0x00,0x80,0x01,0x00,0x7F,0xFE,0x01,0x00,
0x01,0x00,0x01,0x00,0x05,0x00,0x02,0x00,
0x20,0x40,0x30,0x40,0x24,0x4C,0x42,0x70,
0xFF,0x44,0x42,0x46,0x00,0x7C,0x7E,0x00,
0x42,0x40,0x7E,0x4C,0x42,0x70,0x7E,0x40,
0x42,0x44,0x42,0x46,0x4A,0x3C,0x44,0x00,
0x00,0x00,0x0F,0xF0,0x08,0x10,0x0F,0xF0,
0x08,0x10,0x0F,0xF0,0x00,0x00,0xFF,0xFE,
0x01,0x00,0x09,0x00,0x09,0xF8,0x09,0x00,
0x15,0x00,0x23,0x00,0x40,0xFE,0x00,0x00,
0x01,0x00,0x01,0x00,0x02,0x80,0x02,0x40,
0x04,0x20,0x09,0x18,0x11,0x0E,0x61,0x04,
0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,
0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,
0x01,0x00,0xFF,0xFE,0x01,0x00,0x02,0x80,
0x02,0x80,0x02,0x40,0x04,0x40,0x04,0x20,
0x08,0x10,0x10,0x18,0x20,0x0E,0x40,0x04,/
0x08,0x20,0x08,0x20,0x08,0x20,0x4B,0xFE,
0x4A,0x22,0x4A,0x22,0x4A,0x22,0x4A,0x22,
0x4A,0x22,0x4A,0x22,0x4A,0x22,0x12,0x2E,
0x12,0x24,0x20,0x20,0x40,0x20,0x80,0x20,
0x00,0x00,0x7F,0xFC,0x00,0x10,0x1F,0x90,
0x10,0x90,0x1F,0x90,0x10,0x90,0x00,0x04,
0xFF,0xFE,0x00,0x10,0x1F,0x90,0x10,0x90,
0x1F,0x90,0x10,0x90,0x00,0x50,0x00,0x20
};
void delay(uint z)
{
}
void main()
{
}//主函数结束
void ser() interrupt 4
{
}