欢迎光临MCUWAY! 本站网名:单片机之路  永久域名:www.mcuway.com

设为首页

加入收藏

电子基础 初学MCU 单片机类型 MCU程序 MCU应用 设计软件 测控电路 技术论坛
 您现在的位置: 单片机之路 >> 单片机程序 >> 单片机源码 >> 文章正文

用软件仿真串口

;*******************************************************************************

; Duplex UART Routines for the 8xC751 and 8xC752 Microcontrollers

;*******************************************************************************


; This is a demo program showing a way to perform simultaneous RS-232

; transmit and receive using only one hardware timer.

; The transmit and receive routines divide each bit time into 4 slices to

; allow synchronizing to incoming data that may be out of synch with outgoing

; data.

; The main program loop in this demo processes received data and sends it

; back to the transmitter in hexadecimal format. This insures that we can

; always fill up the receiver buffer (since the returned data is longer than

; the received data) for testing purposes. Example: if the letter "A" is

; received, we will echo "A41 ".

;*******************************************************************************

 

;$Title(Duplex UART Routines for the 751/752)

;$Date(8/20/92)

;$MOD751

 

;*******************************************************************************

; Definitions

;*******************************************************************************

; Miscellaneous

TxBitLen EQU -4 + 1 ; Timer slices per serial bit transmit.

RxBitLen EQU -4 + 1 ; Timer slices per serial bit receive.

RxHalfBit EQU (RxBitLen / 4) + 1 ; Timer slices for a partial bit time.

; Used to adjust the input sampling

; time point.

; Note: TxBitLen and RxBitLen are kept separate in order to facilitate the

; possibility of having different transmit and receive baud rates. The timer

; would be set up to give four slices for the fastest baud rate, and the

; BitLen for the slower channel would be set longer for the slower baud rate.

; BitLen = -4 + 1 gives four timer interrupts per bit. BitLen = -8 + 1 would

; give 8 slices, BitLen = -16 + 1 would give 16 slices, etc.

TxPin BIT P1.0 ; RS-232 transmit pin (output).

RxPin BIT P3.2 ; RS-232 receive pin (input).

RTS BIT P1.3 ; RS-232 request to send pin (output).

CTS BIT P1.6 ; RS-232 clear to send pin (input).

; Note: P1.1 and P1.2 are used to input the baud rate selection.

 单片机之路 www.+mcuway+.com

[1] [2] [3] [4] [5] [6] 下一页

普通文章28课:单片机音乐汇编程序设计
普通文章27课:单片机的一些基本概念
普通文章26课:单片机矩阵式键盘接口技术
普通文章51单片机教程(从原理开始基于汇编)
普通文章1课:单片机概述
普通文章2课:8051单片机引脚介绍
普通文章3课:单片机存储器结构结构分析
普通文章4课:第一个单片机小程序
普通文章5课:单片机延时程序分析
普通文章6课:单片机并行口结构
普通文章7课:单片机的特殊功能寄存器
普通文章8课:单片机寻址方式与指令系统
普通文章9课:单片机数据传递类指令
普通文章10课:单片机数据传送类指令
普通文章11课:单片机算术运算指令
普通文章12课:单片机逻辑运算类指令
普通文章13课:单片机逻辑与或异或指令祥解
普通文章14课:单片机条件转移指令
普通文章15课:单片机位操作指令
普通文章16课:单片机定时器与计数器
普通文章17课:单片机定时器/计数器的方式控制
普通文章18课:单片机的中断系统
普通文章19课:单片机定时器、中断试验
普通文章20课:单片机定时/计数器实验
普通文章21课:单片机串行口介绍

  • 上一篇文章:
  • 下一篇文章:
  • 更多精彩内容>>>

    普通文章电流单位
    普通文章功率单位
    普通文章什么是达林顿管?
    普通文章晶闸管的作用与原理

    学习单片机的必经之路——单片机之路,永久域名:www.mcuway.com