基本信息
源码名称:STC8H-485通信输出
源码大小:0.11M
文件格式:.zip
开发语言:C/C++
更新时间:2020-11-28
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 3 元 
   源码介绍


#include "STC8xxxx.h"
#include "intrins.h"
#define uchar unsigned char

#define FOSC    24000000UL
#define BRT     (65536 - FOSC / 9600 / 4)         //可以修改波特率9600


sbit RS485DIR=P3^7;   //RS485DIR=0为对外接收状态  RS485DIR=1为IC往外发送状态
bit busy;
char wptr;
char rptr;
char buffer[16];




void Uart2Isr() interrupt 8
{
    if (S2CON & 0X02)                // 发送中断标志判断,如果条件成立,即发送完成
{                                //00010010&00000010
S2CON&=~0x02;                 // SCON=00010010&11111101=00010000清中断标志bit1:S2TI=0;
  busy = 0;                    // 给busy赋值0,后续判断,满足发送条件

RS485DIR=0;


}
if(S2CON & 0x01);                 // 接收中断标志判断,如果条件成立,即接收完成
{

S2CON&=~0x01;                  // 清中断标志
buffer[wptr ] = S2BUF;           
wptr &=0x0f;                     //清除wptr的高4位,低四位保留

RS485DIR=1;


}

}



【文件目录】

STC8H-485通信输出

├── STC8xxxx.H
├── UART2.c
├── UART2.h
├── list
│   ├── RS485
│   ├── RS485.build_log.htm
│   ├── RS485.hex
│   ├── RS485.lnp
│   ├── RS485.m51
│   ├── UART2.lst
│   ├── daqiya
│   ├── daqiya.build_log.htm
│   ├── daqiya.hex
│   ├── daqiya.lnp
│   ├── daqiya.m51
│   ├── main.lst
│   └── main.obj
├── main.c
├── template.uvgui.wch15
├── template.uvopt
└── template.uvproj
1 directory, 20 files