当前位置:网站首页>Proteus -- RS-232 dual computer communication
Proteus -- RS-232 dual computer communication
2022-07-02 07:03:00 【Wonderful drifting of coal】
1. Circuit diagram
MAX232 by +5V Single power supply RS-232 Level conversion chip , Internal integrated charge pump circuit 、 Can produce +12V and -12V Two power supplies , Provide RS-232 The need of serial port level , The pin diagram is shown in the figure 5~20 Shown . among , Pin 1、2、3、4、5、6 External capacitance , Composition charge pump .T1in、T2in by TTL Level input , convert to RS-232 After level , Respectively from the T1our、T2our Output ;R1in、R2in by RS-232 Level input , convert to TTL After level , Respectively from the R1our、R2our Output .

2. Code
#include<reg51.h>// Include access sfr Library function rug51、h
unsigned char code c[10]=(// Define the sending data array , And the assignment
0xc0,0xf9,0xa4,0xb0,0x99,0x92,0xf8,0xf8,0x80,0x90);//0~9 Gongyang share code
void main(){
unsigned char i;
unsigned long t;
TMOD=0x20;
TH1=0xe8;TL1=0xe8;
SCON=0x40;
PCON=0;
ET1=0;
ES=0;
TR1=1;
while(1){
for(i=0;i<16;i++){
SBUF=c[i];
while(TI==0);
TI=0;
P1=c[i];
for(t=0;t<21740;t++);}}}
(2) Machine B receives
#include<reg51.h>// Include access sfr Library function rug51、h
void main(){
unsigned char i;
TMOD=0x20;
TH1=0xe8;TL1=0xe8;
SCON=0x40;
PCON=0;
ET1=0;
ES=0;
TR1=1;
while(1){
for(i=0;i<16;i++){
REN=1;
while(RI==0);
REN=0;
RI=0
P1=SBUF;}}}
边栏推荐
- Explanation and application of annotation and reflection
- php中的数字金额转换大写数字
- php中判断版本号是否连续
- php中的二维数组去重
- Sqli-labs customs clearance (less1)
- The default Google browser cannot open the link (clicking the hyperlink does not respond)
- Tool grass welfare post
- php中计算两个日期之前相差多少天、月、年
- CVE-2015-1635(MS15-034 )遠程代碼執行漏洞複現
- Win10: add or delete boot items, and add user-defined boot files to boot items
猜你喜欢

Sublime text configuring PHP compilation environment

外币记账及重估总账余额表变化(下)

Stack (linear structure)

User login function: simple but difficult

Latex error: the font size command \normalsize is not defined problem solved

TCP攻击

Wechat applet Foundation

PgSQL learning notes

Ingress Controller 0.47.0的Yaml文件

Spark的原理解析
随机推荐
ts和js区别
Take you to master the formatter of visual studio code
Ingress Controller 0.47.0的Yaml文件
PgSQL learning notes
Sqli labs customs clearance summary-page1
User login function: simple but difficult
Sqli-labs customs clearance (less18-less20)
php中计算树状结构数据中的合计
js判断数组中对象是否存在某个值
js创建一个自定义json数组
Sqli labs customs clearance summary-page2
Linux MySQL 5.6.51 community generic installation tutorial
外币记账及重估总账余额表变化(下)
Explanation and application of annotation and reflection
Date time API details
JS create a custom JSON array
PM2 simple use and daemon
Self study table Au
JS delete the last bit of the string
MySQL中的正则表达式