SCISerialCommunicationsInterface_第1页
SCISerialCommunicationsInterface_第2页
SCISerialCommunicationsInterface_第3页
SCISerialCommunicationsInterface_第4页
SCISerialCommunicationsInterface_第5页
已阅读5页,还剩19页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、1SCI: Serial Communications InterfacePresented by:Sean KlineChad SmithJamie Cruce2Outline General Description of the SCI Serial vs. Parallel Transmission Synchronous vs. Asynchronous Transmission Start, Stop, Data, and Parity Bits Baud vs. Bit Rate Noise SCI Registers Data Word Transmission Examples

2、3What is it?An independent serial I/O system used with the M68HC11 microcontrollerUniversal Asynchronous Receiver Transmitter(UART)4Serial vs. Parallel Serial Data transmitted in one line Slower than parallel transmission Parallel Data transmitted in multiple lines Requires one line per bit of data

3、transmitted in a concurrent fashion Faster than serial transmission5Synchronous vs. Asynchronous Synchronous- One-way communication - Receiver and transmitter must have their clocking “synchronized,” requiring a constant stream of transmission- Request for data is made, time is given for the request

4、 to be carried out, and data is read. Asynchronous- Utilizes start and stop bit to communicate the beginning and end of data words to the receiver- No need for devices to be synchronized6Data Word Start Bit Signals the start of transmission of the data bits Transition from logic 1 to logic 0 Data Bi

5、ts Generally 8 data bits (not including parity bit) Transmitted and received least significant bit first Stop Bit Signals the end of a data word Logic 17Parity Bit Can be added to the transmitted data to check for and display an error message when a bit is lost during transmission Comes in two forms

6、 Odd Parity Sum of the 1s in the frame will be odd The logical state (1 or 0) of the parity bit is selected to fulfill this condition Even Parity Sum of the 1s in a frame will be even Number of 1s checked against the parity bit to determine if any bits were lost during transmission A two bit loss wi

7、ll go undetected with this method8Data Word9Baud and Bit Rates Baud Rate A baud is the “reciprocal of the shortest pulse duration in a data word” inclusive of start, stop, data, and parity bits Baud rate is the total number of bits transmitted per second Data Bit Rate The number of data bits transmi

8、tted in one second. Does not include the start or stop bits10In this example: 1 start bit, 1 stop bit, 1 parity bit, 8 data bits, 11 bits per word, 300 baud rate Bit Time = 1/(Baud rate) = 1/300 = 3.33 msec Character Time = (total bits in word) x (bit time) = 11 x 3.33 = 36.6 msec Data Bit Rate (inc

9、luding parity) = (data bits in word)/(character time)= 9/3.33 = 27011Noise Noise will cause interference in the line, which might cause the word to be misinterpreted Three samples will be taken near the middle of the bit time If noise is detected the noise flag will be set, but the bit will be accep

10、ted if there are more non-noise samples than noise (majority rules) When the start bit is detected, four additional samples are taken during the first half of the time bit to verify the start bit 12Noise Noise can cause the start bit to be detected too soon Noise flag will be set since RT3 is 1 Star

11、t bit will be accepted because majority of samples are 013SCI Registers BAUD sets bit rate SCCR1 (Control Register 1) contains control bits related to the 9-bit data character format and the receiver wake-up feature SCCR2 (Control Register 2) main control register for the SCI subsystem SCSR (Status

12、Register) generate hardware interrupt requests and indicate errors in the reception of a character SCDR (Data Register) main data register for transmitting and receiving (contains a buffer)14BAUD RegisterTCLR clear baud rate timing chain bit (factory testing of MCU)SCP1-SCP0 baud rate prescale selec

13、t bits (determines highest available baud rate in system)RCKB baud rate clock test bit (factory testing of MCU)SCR2-SCR0 baud rate select bits (selects an additional binary submultiple of the highest baud rate)Bits are determined based on the baud rates found in Table 9-3 of HC11 Reference ManuelAdd

14、ress: $102BRead:Write:Reset: Bit 7 6 5 4 3 2 1 0 0 0 0 0 0 U U U 0TCLRSCP1SCP0SCR2SCR0SCR10 0RCKB15SCCR1 RegisterAddress: $102CRead:Write:Reset: Bit 7 6 5 4 3 2 1 0 U U 0 0 0 0 0 0 R8 T8 0 M WAKE 0 0 0 R8 receive data bit 8 (acts as extra bit of RDR) T8 transmit data bit 8 (acts as extra bit of the

15、TDR) M SCI character length bit (controls the character length for both transmitter and receiver at same time) WAKE wakeup method select bit Idle line detection of at least a full character time of idle line Address mark a logic 1 in MSB 16SCCR2 RegisterAddress: $102DRead:Write:Reset: Bit 7 6 5 4 3

16、2 1 0 0 0 0 0 0 0 0 0 TIE TCIE RIE ILIE TE RE RWU SBKTIE transmit interrupt enable bitTCIE transmit complete interrupt enable bitRIE receive interrupt enable bitILIE idle-line interrupt enable bitTE transmit enable bitRE receive enable bitRWU receiver wakeup bitSBK send break bit17SCSR RegisterAddre

17、ss: $102ERead:Write:Reset: Bit 7 6 5 4 3 2 1 0 1 1 0 0 0 0 0 0TDRE TCRDRF IDLE OR NF FE 0TDRE transmit data register empty bit (see if SCDR can accept new data)TC transmit complete bitRDRF receive data register full bitIDLE idle-line detect bit (full character time of logic 1 on the RxD line)OR over

18、run error bit (received character was not read before new character was sent)NF noise FlagFE framing error bit (logic 0 is detected where stop bit was expected)18SCDR RegisterAddress: $102FRead:Write:Reset: Bit 7 6 5 4 3 2 1 0 U U U U U U U U R7 R6 R5 R4 R3 R2 R1 R0 T7 T6 T5 T4 T3 T2 T1 T0 When SCDR

19、 is read , the read-only RDR is accessed When SCDR is written, the write-only TDR is accessed19Port D Related Registers PORTD SCI uses the two LSBs for input/output DDRD data direction register for port D Is not used while SCI is in use but will take over control of port D when the SCI operation is

20、aborted20Steps for Transmitting DataSet Baud rate ($102B) to equal receiverSet TE in SCCR2 ($102B) high to enable Set Wake Up mode in SCCR1 ($102C)TE sends idle character to wake receiverReceiver determines if message is intended for itLoad character into SCDR ($102F)Character placed in shift regist

21、er and shifted outWhen TDRE in SCSR ($102E) sets back to 1, load another character (both polling and interrupts can be used)Transmission complete (TC in SCSR)Idle line rests at logic 1, RWU goes to 021Steps for Receiving DataSet Baud rate in Baud register ($102B) Set bit 4 in SCCR1 ($102C) to select

22、 8 or 9 bit characters; set bit 3 to select wake up modeSet bit 2 in SCCR2 ($102D) to enable receiver; set bit 4 to enable interrupt on idle; set bit 5 to enable interrupt when character received or overrun occursRead status of receive from SCSR ($102E) Bit 5 will be set when data is received; frami

23、ng error sets bit 1; noise sets bit 2; overrun sets bit 3; idle sets bit 4Read data received from SCDR ($102F)If 9 bit data format is used, the ninth bit of data will be located in bit 7 of SCCR1 ($102C)22Example for Transmitting Data*-* Test program for transmitting for serial data. User* specifies 8-bit data. See below.*-MAIN EQU $1040 *Assemble code here starting at $1040PORTC

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论