资源简介
里面是两个51单片机不是利用串口进行的通信,而是通过外部中断,,,模拟目前热门的光通信,但是图中是两个单片机直接相连的,实际中可以用一个发射灯和一个接收灯来模拟两个单片机的相连...是一个比较实用的系统.对于初学者和有这方面研究的人来说是个不错的灵感来源和参考!

代码片段和文件信息
//改的地方
/**************
1. 开外部中断1增加外部中断1函数
****************/
#include
#include
#include
#define uchar unsigned char
#define uint unsigned int
#define signallength 5
sbit lcden=P2^7;
sbit lcdrw=P2^6;
sbit lcdrs=P2^5; //1602定义
sbit clear=P3^5; //接在t1口
sbit k2=P3^2; //接在int0口
sbit k3=P3^3; //接在外部中断1口上开外部中断1就作为中断使用不开则作为普通按键
sbit k4=P3^4; //接在t0口上
sbit redled=P1^0; //代表0的led
sbit busyled=P1^1; //message读取
sbit greenled=P1^3; //代表1的led、
sbit beep=P1^4; //蜂鸣器
sbit del=P1^2; //删除键
sbit delled=P1^5; //删除键的led提示
uchar signal[]=“01“; //attention here
uchar code word[]=“abcdefghijklmnopqrstuvwxyz?!. “;
uchar code inform1[15]=“The Signal Is :“;
uchar code inform2[13]=“The Word Is :“;
uchar code inform3[16]=“The Message Is :“;
uchar code inform4[24]=“Hellow!JiLin University“;
uint code command[5]={0}; //命令数组1,,测试如果收到5个01与此相等,则做出command
uchar code null[1]={‘ ‘}; //空数组用来删除功能的时候将前一位清除内容
uchar message[48]; //用来存放最终结果..
uint wordbuf[5]; //attention here can not use code 用来存放5个二进制位
uchar num; //用来显示1602字符循环使用
uchar time; //计算定时器0定时时长所用
uchar timeflag; //长短标志位,1为长,2为短
uchar signalflag; // 信号长短标识这里假设的到5之后就判断
uint wordsign; //标记word[].其值为word[wirdsign]的下标供lcd显示
uchar reflag=0; //恢复标识用于一次译码之后重新初始化的那几句用的
uchar mess; //message[mess]
uchar messageflag; //message 标识说明此条message已经显示过了
uint messagelength; //识别message的长度以便刷屏显示
uint commandflag; //命令测试状态字,如果5个,0或者1与command[]测试相等,则此状态字置一
void delay(uint z)
{
uint xy;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void write_com(uchar com)
{
lcdrs=0;
P0=com;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void write_data(uchar date)
{
lcdrs=1;
P0=date;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void displayDone()
{
write_com(0x01);
delay(2);
write_com(0x80+0x06);
write_data(word[3]);
delay(5);
write_data(word[14]);
delay(5);
write_data(word[13]);
delay(5);
write_data(word[4]);
delay(5);
write_data(word[27]);
}
void displaynomessage()
{
write_com(0x80+0X03);
write_data(word[13]); //n
write_data(word[14]); //0
write_data(word[31]); //
write_data(word[12]); // m
write_data(word[4]); // e
write_data(word[18]); // s
write_data(word[18]); // s
write_data(word[0]); // a
write_data(word[6]); // g
write_data(word[4]); // e
write_data(word[27]); // !
}
void displaycommand()
{
write_com(0x01);
write_com(0x80+0x04);
for(num=0;num<7;num++)
{
write_data(inform4[num]);
delay(150);
}
write_com(0x80+0x40);
for(num=7;num<23;num++)
{
write_data(inform4[num]);
delay(150);
}
}
void Init1602()
{
lcden=0;
lcdrw=0;
write_com(0x38);
write_com(0x0f);
write_com(0x06);
write_com(0x01);
write_com(0x80);
}
void Initinterrupt(void)
{
TMOD
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-12-14 00:23 基于1602的自制双机无线通信模块proteus仿真原理图\
文件 279701 2012-12-09 23:30 基于1602的自制双机无线通信模块proteus仿真原理图\1602液晶说明.pdf
文件 172648 2012-12-11 23:48 基于1602的自制双机无线通信模块proteus仿真原理图\1602自制双机无线通信proteus仿真图.DSN
文件 640298 2012-12-05 22:43 基于1602的自制双机无线通信模块proteus仿真原理图\C51函数参考.pdf
目录 0 2012-12-10 19:15 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\
文件 22921 2012-12-10 17:45 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\combine attempt 8
文件 26011 2012-12-10 17:45 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\combine attempt 8.LST
文件 27484 2012-12-10 17:45 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\combine attempt 8.M51
文件 24094 2012-12-10 17:45 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\combine attempt 8.OBJ
文件 10133 2012-12-10 17:45 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\combine attempt 8.c
文件 11095 2012-12-10 17:45 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\combine attempt 8.hex
文件 66 2012-12-10 17:45 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\combine attempt 8.lnp
文件 4752 2012-12-10 17:45 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\combine attempt 8.plg
文件 55229 2012-12-10 19:15 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\combine attempt 8.uvopt
文件 13259 2012-12-10 00:34 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\combine attempt 8.uvproj
文件 55229 2012-12-10 16:50 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\combine attempt 8_uvopt.bak
文件 0 2012-12-09 23:37 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\combine attempt 8_uvproj.bak
文件 57 2012-12-10 17:44 基于1602的自制双机无线通信模块proteus仿真原理图\combine attempt 8\说明.txt
目录 0 2012-12-10 19:27 基于1602的自制双机无线通信模块proteus仿真原理图\send attempt 5\
文件 22669 2012-12-10 17:57 基于1602的自制双机无线通信模块proteus仿真原理图\send attempt 5\send attempt 5
文件 25562 2012-12-10 17:57 基于1602的自制双机无线通信模块proteus仿真原理图\send attempt 5\send attempt 5.LST
文件 26709 2012-12-10 17:57 基于1602的自制双机无线通信模块proteus仿真原理图\send attempt 5\send attempt 5.M51
文件 23737 2012-12-10 17:57 基于1602的自制双机无线通信模块proteus仿真原理图\send attempt 5\send attempt 5.OBJ
文件 10083 2012-12-10 17:57 基于1602的自制双机无线通信模块proteus仿真原理图\send attempt 5\send attempt 5.c
文件 10909 2012-12-10 17:57 基于1602的自制双机无线通信模块proteus仿真原理图\send attempt 5\send attempt 5.hex
文件 60 2012-12-10 17:57 基于1602的自制双机无线通信模块proteus仿真原理图\send attempt 5\send attempt 5.lnp
文件 601 2012-12-10 17:57 基于1602的自制双机无线通信模块proteus仿真原理图\send attempt 5\send attempt 5.plg
文件 55216 2012-12-10 19:27 基于1602的自制双机无线通信模块proteus仿真原理图\send attempt 5\send attempt 5.uvopt
文件 13250 2012-12-10 00:34 基于1602的自制双机无线通信模块proteus仿真原理图\send attempt 5\send attempt 5.uvproj
文件 55220 2012-12-10 16:50 基于1602的自制双机无线通信模块proteus仿真原理图\send attempt 5\send attempt 5_uvopt.bak
文件 0 2012-12-09 23:34 基于1602的自制双机无线通信模块proteus仿真原理图\send attempt 5\send attempt 5_uvproj.bak
............此处省略1个文件信息
- 上一篇:武术擂台技术挑战赛机器人整体设计
- 下一篇:新树洞表白源码
相关资源
- [免费]msp430f149控制PS2键盘并用1602显示
- vhdl与lcd1602实现的多控制电子钟
- ADC0809数字电压表 LCD1602显示 汇编程序
- 光通信基本教程--详细描述光纤通
- STM32+1602液晶proteus仿真.zip
- ASUS华硕P9X79主板BIOS v1602官方版
- 光通信参考设计:GPON(MOGPON)ONT模块含
- LCD1602显示程序
- 循迹小车51程序(超声波 颜色识别 舵
- 1602液晶显示51串口接受的数据
- 第四章 畅学多功能实验箱液晶资源详
- proteus仿真、keil4、DHT11、LCD1602
- 1602lcd液晶屏参数详细介绍
- Optiwave OptiSystem 7.0.zip
- DS18B20温度+DHT11湿度+LCD1602
- STM32通过串口实现双机通信,达到数据
- STM32通过串口实现双机通信,实现数据
- DS18B20-液晶1602显示温度和控制(代码
- 光通信中的OFDM
- ISO/IEC 16022:2006 DataMatrix
- 基于FPGA的LCD1602实时显示DS18b20温度
- STM32+ZE08-CH2O甲醛传感器+LCD1602显示.r
- 基于51单片机的电机转速监测
- FPGA VGA lcd1602 显示时钟 闹钟 按键控制
- STM32f103电压采样并用LCD1602显示
- 华为培训 G.709协议解读------v1.1
- STM32 HAL库版本 4线1602A程序
- STM32CubeMX+LCD1602 + PCF8574AT
- STM32驱动1602
- 光通信集成电路设计(影印版)(国
评论
共有 条评论