1 / 9

SCI (Serial Communication Interface)

SCI (Serial Communication Interface). Tsinghua Motorola MCU and DSP Application Center 2002.2.26. 异步串行通信接口 SCI 功能. 标准 NRZ 格式 全双工操作,发送器和接收器分别有独立的允许位 软件预置 32 种波特率之一 软件选择数据字长(每字 8 或 9 个 bit ) SCI 可用中断驱动,有四个分立 的中断条件. RS-232C 接口信号. NRZ 数据格式. NRZ 数据格式的基本特点为: 高电平为逻辑 1 ,低电平为逻辑 0

suzy
Télécharger la présentation

SCI (Serial Communication Interface)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SCI (Serial Communication Interface) Tsinghua Motorola MCU and DSP Application Center 2002.2.26

  2. 异步串行通信接口SCI 功能 • 标准NRZ格式 • 全双工操作,发送器和接收器分别有独立的允许位 • 软件预置32种波特率之一 • 软件选择数据字长(每字8或9个bit) • SCI可用中断驱动,有四个分立的中断条件

  3. RS-232C接口信号

  4. NRZ数据格式 • NRZ数据格式的基本特点为: • 高电平为逻辑1,低电平为逻辑0 • 发送/接收数据空闲时为高电平 • 发送/接收数据的第一位是起始位(逻辑0) • 发送/接收数据从低位开始 • 数据串的最后一位是停止位(逻辑1)

  5. 波特率寄存器SCBR SCP1-SCP0位是分频预选择,对应内部处理时钟的1,3,4,13分频;SCR2-SCR0位是分频选择,对应预分频输出的1,2,4,8,16,32,64,128分频。 波特率=Fbus/(64×PD×BD) Fbus为微控制器内部总线时钟,PD为预分频值,BD为分频值

  6. 分频因子

  7. 串行通讯控制寄存器1 (SCC1) • LOOPS:循环模式选择位,当置位时,选择循环模式。 • ENSCI:当置位该位时,允许SCI。 • TXINV:当置位该位时,发送输出为反码。 • M:字符长度选择,置位时为9位,清零时为8位。 • WAKE:唤醒条件选择,1=地址唤醒;0=空闲线唤醒。 • ILTY:空闲线方式选择,1=从停止位开始计数;0=从起始位开始计数。 • PEN:奇偶校验允许位,置位时允许奇偶校验。 • PTY:校验类型选择,1=奇校验;0=偶校验。

  8. 串行通讯控制寄存器2(SCC2) • SCTIE:1=允许SCI发送中断; • TCIE:1=允许发送完成中断; • SCRIE:1=允许SCI接收中断; • ILIE:1=允许空闲中断; • TE:1=允许发送器; • RE:1=允许接收器; • RWU:1=置SCI为等待状态; • SBK:1=发送终止码。

  9. SCI范例 *SCI初始化LDA #%01000000 ;设置SCI控制字SC1 STA SCC1 LDA #%00001100 ;设置SCI控制字SC2 STA SCC2 LDA #%00000000 ;设置SCI控制字SC3 STA SCC3 LDA #$02 ;设置波特率STA BAUD *SCI读取数据GETDATA: BRCLR b_SCRF,SCS1,GETDATA ;查询SCI是否读入数据LDA SCDR ;保存数据RTS ;返回主程序 *SCI传送数据SENDATA: BRCLR b_SCTE,SCS1,SENDATA ;查询是否输出数据STA SCDR ;传送数据RTS ;返回主程序

More Related