汽車尾燈控制電路設(shè)計(jì)資料
汽車尾燈控制電路設(shè)計(jì)資料,汽車,尾燈,控制電路,設(shè)計(jì),資料
1 引言
在日新月異的21世紀(jì)里,電子產(chǎn)品得到了迅速發(fā)展。許多電器設(shè)備都趨于人性化、智能化,這些電器設(shè)備大部分都含有CPU控制器或者是單片機(jī)。單片機(jī)以其高可靠性、高性價(jià)比、低電壓、低功耗等一系列優(yōu)點(diǎn),近幾年得到迅猛發(fā)展和大范圍推廣,廣泛應(yīng)用于工業(yè)控制系統(tǒng)、通訊設(shè)備、日常消費(fèi)類產(chǎn)品和玩具等。并且已經(jīng)深入到工業(yè)生產(chǎn)的各個(gè)環(huán)節(jié)以及人民生活的各個(gè)方面,如車間流水線控制、自動(dòng)化系統(tǒng)等、智能型家用電器(冰箱、空調(diào)、彩電)等。用單片機(jī)來控制的小型電器產(chǎn)品具有便攜實(shí)用,操作簡(jiǎn)單的特點(diǎn)。
本文設(shè)計(jì)的汽車尾燈控制電路屬于小型智能電子產(chǎn)品。利用單片機(jī)進(jìn)行控制,實(shí)時(shí)時(shí)鐘芯片進(jìn)行記時(shí),外加掉電存儲(chǔ)電路和顯示電路。此設(shè)計(jì)具有相當(dāng)重要的現(xiàn)實(shí)意義和實(shí)用價(jià)值。
2 系統(tǒng)概述
本設(shè)計(jì)以AT89S52單片機(jī)為核心,構(gòu)成單片機(jī)控制電路,完成對(duì)它們的自動(dòng)調(diào)整和掉電保護(hù)。人機(jī)接口由四個(gè)按鍵來實(shí)現(xiàn),用這四個(gè)按鍵對(duì)汽車左轉(zhuǎn),右轉(zhuǎn),停車和檢測(cè)進(jìn)行控制。。軟件控制程序?qū)崿F(xiàn)所有的功能。整機(jī)電路使用+5V穩(wěn)壓電源,可穩(wěn)定工作。系統(tǒng)框圖如圖2-1所示,其軟硬件設(shè)計(jì)簡(jiǎn)單,可廣泛應(yīng)用于長(zhǎng)時(shí)間工作的系統(tǒng)中。
人機(jī)接口
顯示電路
軟件控制程序
電源電路
單片機(jī)控制電路
圖2-1 系統(tǒng)框圖
3 方案選擇
由于汽車尾燈控制電路的種類比較多,因此方案選擇在設(shè)計(jì)中是至關(guān)重要的。正確地選擇方案可以減小開發(fā)難度,縮短開發(fā)周期,降低成本,更快地將產(chǎn)品推向市場(chǎng)。
3.1 方案1——基于AT89S52單片機(jī)的汽車尾燈控制電路設(shè)計(jì)
直接用AT89S52單片機(jī)來實(shí)現(xiàn)汽車尾燈控制電路設(shè)計(jì)。AT89S52是一種帶8K字節(jié)閃爍可編程可擦除只讀存儲(chǔ)器的低電壓,高性能CMOS 8位微處理器,俗稱單片機(jī)。單片機(jī)的可擦除只讀存儲(chǔ)器可以反復(fù)擦寫1000余次。由于將多功能8位CPU和閃爍存儲(chǔ)器組合在單個(gè)芯片中,ATMEL的AT89S52是一種高效微控制器,為很多嵌入式控制系統(tǒng)提供了一種靈活性高且價(jià)廉的方案。
用單片機(jī)來實(shí)現(xiàn)汽車尾燈控制電路設(shè)計(jì),無(wú)須外接其他芯片,充分利用了單片機(jī)的資源。
3.2 方案2——基于電子元件的汽車尾燈控制電路設(shè)計(jì)
用電子元件接的汽車尾燈控制電路,電路復(fù)雜,接點(diǎn)較多,電路穩(wěn)定性差。
汽車左右和剎車仿真電路
開關(guān)控制電路
譯碼電路74138
顯示驅(qū)動(dòng)電路
記數(shù)電路74161
R1R2R3 L1L2L3
脈沖產(chǎn)生電路555
汽車尾燈控制電路設(shè)計(jì)總體框圖
4 系統(tǒng)硬件電路的設(shè)計(jì)
按照系統(tǒng)設(shè)計(jì)功能的要求,初步確定設(shè)計(jì)系統(tǒng)由主控模塊、鍵盤接口模塊、顯示模塊共3個(gè)模塊組成,電路系統(tǒng)構(gòu)成框圖如圖4-1所示。主控芯片使用52系列AT89S52單片機(jī),
(89S52)
主控模塊
時(shí)鐘電路
鍵掃描電路
晶體管顯示
存儲(chǔ)電路
圖4-1 汽車尾燈控制電路系統(tǒng)構(gòu)成框圖
4.1 系統(tǒng)核心部分——閃電存儲(chǔ)型器件AT89S52
4.1.1 AT89S52具有下列主要性能[5]:
·8KB可改編程序Flash存儲(chǔ)器(可經(jīng)受1000次的寫入/擦除周期)
·全靜態(tài)工作:0Hz~24MHz
·三級(jí)程序存儲(chǔ)器保密
·128×8字節(jié)內(nèi)部RAM
·32條可編程I/O線
·2個(gè)16位定時(shí)器/計(jì)數(shù)器
·6個(gè)中斷源
·可編程串行通道
·片內(nèi)時(shí)鐘振蕩器
4.1.2 AT89S52的引腳及功能
AT89S52單片機(jī)的管腳說明如圖4-2所示。
圖4-2 AT89S52的管腳
(1) 主要電源引腳
①VCC 電源端
②GND 接地端
(2) 外接晶體引腳XTAL1和XTAL2
①XTAL1 接外部晶體的一個(gè)引腳。在單片機(jī)內(nèi)部,它是構(gòu)成片內(nèi)振蕩器的反相放大器的輸入端。當(dāng)采用外部振蕩器時(shí),該引腳接收振蕩器的信號(hào),既把此信號(hào)直接接到內(nèi)部時(shí)鐘發(fā)生器的輸入端。
②XTAL2 接外部晶體的另一個(gè)引腳。在單片機(jī)內(nèi)部,它是上述振蕩器的反相放大器的輸出端。采用外部振蕩器時(shí),此引腳應(yīng)懸浮不連接。
(3) 控制或與其它電源復(fù)用引腳RST、ALE//PROG、/PSEN和/EA/VPP
①RST 復(fù)位輸入端。 當(dāng)振蕩器運(yùn)行時(shí),在該引腳上出現(xiàn)兩個(gè)機(jī)器周期的高電平將使單片機(jī)復(fù)位。
②ALE//PROG 當(dāng)訪問外部存儲(chǔ)器時(shí),ALE(地址鎖存允許)的輸出用于鎖存地址的低位字節(jié)。即使不訪問外部存儲(chǔ)器,ALE端仍以不變的頻率(此頻率為振蕩器頻率的1/6)周期性地出現(xiàn)正脈沖信號(hào)。因此,它可用作對(duì)外輸出的時(shí)鐘,或用于定時(shí)目的。然而要注意的是:每當(dāng)訪問外部數(shù)據(jù)存儲(chǔ)器時(shí),將跳過一個(gè)ALE脈沖。在對(duì)Flash存儲(chǔ)器編程期間,該引腳還用于輸入編程脈沖(/PROG)[6]。
③/PSEN 程序存儲(chǔ)允許(/PSEN)輸出是外部程序存儲(chǔ)器的讀選通信號(hào)。當(dāng)AT89S52/LV52由外部程序存儲(chǔ)器取指令(或常數(shù))時(shí),每個(gè)機(jī)器周期兩次/PSEN有效(既輸出2個(gè)脈沖)。但在此期間內(nèi),每當(dāng)訪問外部數(shù)據(jù)存儲(chǔ)器時(shí),這兩次有效的/PSEN信號(hào)將不出現(xiàn)。
④/EA/VPP 外部訪問允許端。要使CPU只訪問外部程序存儲(chǔ)器(地址為0000H~FFFFH),則/EA端必須保持低電平(接到GND端)。當(dāng)/EA端保持高電平(接VSS端)時(shí),CPU則執(zhí)行內(nèi)部程序存儲(chǔ)器中的程序。
(4) 輸入/輸出引腳 P0.0~ P0.7、P1.0~P1.7、P2.0~ P2.7 和P3.0~P3.7
①P0端口(P0.0~ P0.7) P0是一個(gè)8位漏極開路型雙向I/O端口。作為輸出口用時(shí),每位能以吸收電流的方式驅(qū)動(dòng)8個(gè)TTL輸入,對(duì)端口寫1時(shí),又可作高阻抗輸入端用。
②P1端口(P1.0~ P1.7) P1是一個(gè)帶有內(nèi)部上拉電阻的8位雙向I/O端口。P1的輸出緩沖器可驅(qū)動(dòng)(吸收或輸出電流方式)4個(gè)TTL輸入。對(duì)端口寫1時(shí),通過內(nèi)部的上拉電阻把端口拉到高電位,這時(shí)可用作輸入口。作輸入口時(shí),因?yàn)橛袃?nèi)部的上拉電阻,那些被外部信號(hào)拉低的引腳會(huì)輸出一個(gè)電流。
③P2端口 (P2.0~P2.7) P2是一個(gè)帶有內(nèi)部上拉電阻的8位雙向I/O端口。P2的輸出緩沖器可驅(qū)動(dòng)(吸收或輸出電流方式)4個(gè)TTL輸入。對(duì)端口寫1時(shí),通過內(nèi)部的上拉電阻把端口拉到高電位,這時(shí)可用作輸入口。P2作輸入口使用時(shí),因?yàn)橛袃?nèi)部的上拉電阻,那些被外部信號(hào)拉低的引腳會(huì)輸出一個(gè)電流。
④P3端口(P3.0~P3.7) P3口管腳是8個(gè)帶內(nèi)部上拉電阻的雙向I/O口,可接收輸出4個(gè)TTL門電流。當(dāng)P3口寫入“1”后,它們被內(nèi)部上拉為高電平,并用作輸入。作為輸入,由于外部下拉為低電平,P3口將輸出電流,這是由于上拉的緣故。
P3口也可作為AT89S52的一些特殊功能,這些特殊功能見表4-1[7]。
表4-1 P3端口的特殊功能
端口引腳
兼 用 功 能
P3.0
RXD (串行輸入口)
P3.1
TXD (串行輸出口)
P3.2
/INT0 (外部中斷0)
P3.3
/INT1 (外部中斷1)
P3.4
T0 ( 定時(shí)器0的外部輸入)
P3.5
T1 (定時(shí)器1的外部輸入)
P3.6
/WR (外部數(shù)據(jù)存儲(chǔ)器寫選通)
P3.7
/RD (外部數(shù)據(jù)存儲(chǔ)器讀選通)
4.5 鍵盤電路
本設(shè)計(jì)共采用按鍵4個(gè),分別與單片機(jī)的P2.0、P2.1、P2.2、P2.3口相連,分別對(duì)應(yīng)汽車左轉(zhuǎn),汽車右轉(zhuǎn),剎車和檢測(cè)的功能。
7 結(jié)論
本設(shè)計(jì)硬件電路較簡(jiǎn)單,所用器件較少,電路中使用了AT89S52單片主要芯片,實(shí)現(xiàn)了預(yù)計(jì)功能。
在對(duì)芯片的管腳功能和用法有充分的了解后,根據(jù)設(shè)計(jì)要求設(shè)計(jì)硬件電路,然后通過軟件編程,用按鍵進(jìn)行控制,用發(fā)光二極管進(jìn)行顯示。
汽車尾燈控制電路可以正常顯示汽車的左轉(zhuǎn),右轉(zhuǎn),停車和檢測(cè)功能,基本完成了預(yù)期要實(shí)現(xiàn)的目標(biāo)。
參考文獻(xiàn)
1.康華光主編,電子技術(shù)基礎(chǔ)(數(shù)字部分),高等教育出版社
2.標(biāo)準(zhǔn)集成電路數(shù)據(jù)手冊(cè)TTL電路,電子工業(yè)出版社
致 謝
不知不覺,六周的畢業(yè)設(shè)計(jì)結(jié)束了。我的畢業(yè)論文已整理完畢,電路調(diào)試進(jìn)展良好。畢業(yè)設(shè)計(jì)的完成意味著我的大學(xué)學(xué)習(xí)生活即將結(jié)束,從此我將進(jìn)入一個(gè)新的人生旅途、開始一段嶄新的生活——工作。在此,我衷心地感謝所有在我做畢業(yè)設(shè)計(jì)期間幫助過我的人。
首先我要感謝我的指導(dǎo)老師李杰的大力幫助和支持。在整個(gè)設(shè)計(jì)過程當(dāng)中,李老師在大局上指導(dǎo)我畢業(yè)設(shè)計(jì)的每一進(jìn)程,還在百忙中抽空為我答疑解難,幫我分析講解畢業(yè)設(shè)計(jì)中所遇到的問題。不僅如此,李老師還無(wú)私的給我提供了豐富的學(xué)習(xí)資源和良好的學(xué)習(xí)環(huán)境,為我的畢業(yè)設(shè)計(jì)帶來了很大方便。同時(shí)在我完成畢業(yè)設(shè)計(jì)的過程中提供了很多指導(dǎo)性的意見,使我受益匪淺。另外,李老師淵博的學(xué)識(shí)、嚴(yán)謹(jǐn)?shù)闹螌W(xué)態(tài)度和為人給了我很大的教育,這些將使我終身受益。在此,我衷心感謝李老師給予我的幫助和教育。
此外,我還要感謝夏九和李國(guó)華同學(xué)給予我的無(wú)私的幫助,他們?cè)诔绦蚓帉懞驼{(diào)試過程中給予了我莫大的幫助。在此,我真誠(chéng)地感謝他們。
最后,我要感謝我的母校——天津工程師范學(xué)院,在校期間,這里給我留下了美好的回憶。特別是在我即將踏上工作崗位的同時(shí),畢業(yè)設(shè)計(jì)整個(gè)過程給了我這樣一個(gè)鍛煉的機(jī)會(huì),使我加深了對(duì)以前知識(shí)的理解和鞏固,拓寬了知識(shí)面,也提高了我對(duì)所學(xué)知識(shí)的綜合應(yīng)用能力。我要對(duì)母校說:母校有我三五載,我愛母校一萬(wàn)年。祝愿母校的將來更美好!
附錄1:汽車尾燈控制電路設(shè)計(jì)電路原理圖
附錄2 主程序
org 00h
ajmp start
ORG 001BH ;定時(shí)器T1中斷程序入口
LJMP time1 ;跳至INTT1執(zhí)行
org 0030h
start: mov TMOD,#10h
mov IE,#88h
MOV TH1,#00h
MOV TL1,#00h
mov r7,#03h;
setb TR1
turn: jnb p2.0,is_key
jnb p2.1,is_key
jnb p2.2,is_key
jnb p2.3,is_key
orl p1,#0ffh;
is_key : jb p2.3,no_check;
anl p1,#0c0h;
jmp turn
no_check:
jmp turn
time1: push acc
mov TH1,#010h
mov TL1,#00h
jb p2.0,left
djnz r7,return
mov r7,#3
xrl p1,#3fh
left: jb p2.1,right
dec r7;
cjne r7,#6,next1;
mov p1,#0fbh
next1: cjne r7,#3,next2;
mov p1,#0fdh;
next2: cjne r7,#0,right;
mov p1,#0feh
mov r7,#9;
right: jb p2.2,return
dec r7;
cjne r7,#6,next11;
mov p1,#0f7h
next11: cjne r7,#3,next21;
mov p1,#0efh;
next21: cjne r7,#0,return;
mov p1,#0dfh
mov r7,#9;
return: pop acc
reti
end
英文資料及中文翻譯
6 TRANSMISSIONS OF DIGITAL DATA:
INTERFACES AND MODEMS
(From Introduction to Data Communications and Net Working,
Behrouz Forouzan)
Once we have encoder our information into a format that can be transmitted, the next step is to investigate the transmission process itself. Information-processing equipment such as PCs generate encoded signals but ordinarily require assistance to transmit those signals over a communication link. For example, a PC generates a digital signal but needs an additional device to modulate a carrier frequency before it is sent over a telephone line. How do we relay encoded data from the generating device to the next device in the process? The answer is a bundle of wires, a sort of mini communication link, called an interface.
Because an interface links two devices not necessarily made by the same manufacturer, its characteristics must be defined and standards must be established. Characteristics of an interface include its mechanical specifications (how many wires are used to transport the signal); its electrical specifications (the frequency, amplitude, and phase of the expected signal); and its functional specifications (if multiple wires are used, what does each one do?). These characteristics are all described by several popular standards and are incorporated in the physical layer of the OSI model.
6.1 DIGITAL DATA TRANSMISSION
Of primary concern when considering the transmission of data from one device to another is the wiring. And of primary concern when considering the wiring is the data stream. Do we send one bit at a time, or do we group bits into larger groups and, if so, how? The transmission of binary data across a link can be accomplished either in parallel mode or serial mode. In parallel mode, multiple bits are sent with each clock pulse. In serial mode, one bit is sent with each clock pulse. While there is only one way to send parallel data, there are two subclasses of serial transmission: synchronous and asynchronous (see Figure 6-1).
Parallel Transmission
Binary data, consisting of 1s and 0s, may be organized into groups of n bits each. Computers produce and consume data in groups of bits much as we conceive of and use spoken language in the form of words rather than letters. By grouping, we can send data n bits at a time instead of one. This is called parallel transmission.
Data transmission
Parallel
Serial
Synchronous
Asynchronous
Figure 6-1 Data transmission
The mechanism for parallel transmission is a conceptually simple one: use n wires to send n bits at one time. That way each bit has its own wire, and all n bits of one group can be transmitted with each clock pulse from one device to another. Figure 6-2 shows how parallel transmission works for n=8.Typically the eight wires are bundled in a cable with a connector at each end.
Sender
Receiver
We need eight lines
s
8 bit synchronously
Figure 6-2 Parallel transmission
The advantage of parallel transmission is speed. All else being equal, parallel transmission can increase the transfer speed by a factor of n over serial transmission. But there is a significant disadvantage:
cost. Parallel transmission requires n communication lines (wires in the example) just to transmit the data stream. Because this is expensive, parallel transmission is usually limited to short distances, up to a maximum of say 25 feet.
Serial Transmission
In serial transmission one bit follows another, so we need only one communication channel rather than n to transmit data between two communicating devices .
The advantage of serial over parallel transmission is that with only one communication channel, serial transmission reduces the cost of transmission over parallel by roughly a factor of n.
Since communication within devices is parallel, conversion devices are required at the interface between the sender and the line (parallel-to-parallel).
Serial transmission occurs in one of two ways: asynchronous or synchronous.
Asynchronous Transmission
Asynchronous transmission is so named because the timing of a signal is unimportant. Instead, information is received and translated by agreed-upon patterns. As long as those patterns are followed, the receiving device can retrieve the information without regard to the rhythm in which it is sent. Patterns are based on grouping the bit stream into bytes. Each group, usually eight bits, is sent along the link as a unit. The sending system handles each group independently, relaying it to the link whenever ready, without regard to a timer.
Without a synchronizing pulse, the receiver cannot use timing to predict when the next group will arrive. To alert the receiver to the arrival of a new group, therefore, an extra bit is added to the beginning of each byte. This bit, usually a 0, is called the start bit. To let the receiver know that the byte is finished, one or more additional bits are appended to the end of the byte. These bits, usually 1s, are called stop bits. By this method, each byte is increased in size to at least 10 bits, of which 8 are information and 2 or more are signals to the receiver. In addition, the transmission of each byte may then be followed by a gap of varying duration. This gap can be represented either by an idle channel or by a stream of additional stop bits.
In asynchronous transmission we send one start bit (0) at the beginning and one or more stop bits (1s) at the end of each byte. There may be a gap between each byte.
The start and stop bits and the gap alert the receiver to the beginning and end of each byte and allow it to synchronize with the data stream. This mechanism is called asynchronous because, at the byte level, sender and receiver do not have to be synchronized. But within each byte, the receiver must still be synchronized with the incoming bit stream. This is, some synchronization is required, but only for the duration of a single byte. The receiving device resynchronizes at the onset of each new byte. When the receiver detects a start bit, it sets a timer and begins counting bits as they come in. after n bits the receiver looks for a stop bit. As soon as it detects the stop bit, it ignores any received pulses until it detects the next start bit.
Asynchronous here means “asynchronous at the byte level,” but the bits are still synchronized; their durations are the same.
The addition of stop and start bits and the insertion of gaps into the bit stream make asynchronous transmission slower than forms of transmission that can operate without the addition of control information. But it is cheap and effective, two advantages that make it an attractive choice for situations like low-speed communication. For example, the connection of a terminal to a computer is a natural application for asynchronous transmission. A user types only one character at a time, types extremely slowly in data processing terms, and leaves unpredictable gaps of time between each character.
Synchronous Transmission
In synchronous transmission, the bit stream is combined into longer “frames,” which may contain multiple bytes. Each byte, however, is introduced onto the transmission link without a gap between it and the next one. It is left to the receiver to separate the bit stream into bytes for decoding purposes. In other words, data are transmitted as an unbroken string of 1s and 0s, and the receiver separates that string into the bytes, or characters, it needs to reconstruct the information.
In synchronous transmission we send bits one after another without start/stop bits or gaps. It is the responsibility of the receiver to group the bits.
Without gaps and start/stop bits, there is no built-in mechanism to help the receiving device adjust its bit synchronization in midstream. Timing becomes very important, therefore, because the accuracy of the received information is completely dependent on the ability of the receiving device to keep an accurate count of the bits as they come in.
The advantage of synchronous transmission is speed. With no extra bits or gaps to introduce at the sending end and remove at the receiving end and, by extension, with fewer bits to move across the link, synchronous transmission is faster than asynchronous transmission is faster than asynchronous transmission. For this reason, it is more useful for high-speed applications like the transmission of data from one computer to another. Byte synchronization is accomplished in the data link layer.
6.2 DTE-DCE INTERFAC
At this point we must clarify two terms important to computer networking: data terminal equipment (DTE). There are usually four basic functional units involved in the communication of data: a DTE and DCE on one end and a DCE and DTE on the other end. The DTE generates the data and passes them, along with any necessary control characters, to a DCE. The DCE does the job of converting the signal to a format appropriate to the transmission medium and introducing it onto the network link. When the signal arrives at the receiving end, this process is reversed.
Data Terminal Equipment (DTE)
Data terminal equipment (DTE) includes any unit that functions either as a source of or as a destination for binary digital data. At the physical layer, if can be a terminal, microcomputer, computer, printer, fax machine, or any other device that generates or consumes digital data. DTEs do not often communicate directly with one another, they generate and consume information but need an intermediary to be able to communicate. Think of a DTE as operating the way your brain does when you talk. Let’s say you have an idea that you want to communicate to a friend. Your brain creates the idea but cannot transmit that idea to your friend’s brain by itself. Unfortunately or fortunately, we are not a species of mind readers. Instead, your brain passes the idea to your vocal chords and mouth, which convert it to sound waves that can travel through the air or over a telephone line to your friend’s ear and from there to his or her brain, where it is converted back into information. In this model, your brain and your friend’s brain are DTEs. Your vocal chords and mouth are your DCE. His or her ear is also a DCE. The air or telephone wire is your transmission medium.
A DTE is any device that is a source of or destination for binary digital data.
Data Circuit-Terminating Equipment (DCE)
Data circuit-terminating equipment (DCE) includes any functional unit that transmits or receives data in the form of an analog or digital signal through a network. At the physical layer, a DCE takes data generated by a DTE, converts them to an appropriate signal, and then introduces the signal onto the telecommunication link. Commonly used DCEs at this layer include modems . In any network, a DTE generates digital data and passes it to a DCE; the DCE converts the data to a form acceptable to the transmission medium and sends the converted signal to another DCE on the network. The second DCE takes the signal off the line, converts it to a form usable by its DTE, and delivers it. To make this communication possible, both the sending and receiving DCEs must use the same encoding method, much the way that if you want to communicate to someone who understands only Japanese, you must speak Japanese. The two DTEs do not need to be coordinated with each other, but each of them must be coordinated with its own DCE and the DCEs must be coordinated so that data translation occurs without loss of integrity.
A DCE is any device that transmits or receives data in the form of an analog or digital signal through a network.
6 數(shù)字?jǐn)?shù)據(jù)傳輸:接口和調(diào)制解調(diào)器
(選自?數(shù)據(jù)通信與網(wǎng)絡(luò)?, Behrouz Forouzan著)
我們將信息編碼成可以傳輸?shù)母袷剑乱徊骄褪翘接憘鬏斶^程了。信息處理設(shè)備如個(gè)人計(jì)算機(jī)能生成編碼信號(hào),通常還需要其它設(shè)備協(xié)助才能將這些信號(hào)在通信鏈路上傳輸。例如一臺(tái)PC機(jī)產(chǎn)生數(shù)字信號(hào),在將信號(hào)通過電話線發(fā)送之前,還需要一臺(tái)附加設(shè)備來調(diào)制載波頻率。在這過程中,我們?cè)鯓硬拍馨褦?shù)據(jù)從產(chǎn)生它的設(shè)備傳送到下一個(gè)設(shè)備呢?解決辦法是使用一捆導(dǎo)線,成為一種為通信鏈路,或叫接口。
因?yàn)榻涌谶B接的兩個(gè)設(shè)備有可能不是一個(gè)廠家生產(chǎn)的,所以必須規(guī)定接口的特性并建立標(biāo)準(zhǔn)。接口特性包括機(jī)械規(guī)范(使用多少條導(dǎo)線來傳輸信號(hào))、電氣規(guī)范(預(yù)期信號(hào)的頻率、振幅和相位)以及功能規(guī)范(如果使用多條導(dǎo)線,每條導(dǎo)線的功能是什么?)。這些特性在一些常用標(biāo)準(zhǔn)中都有描述并且被集成到了OSI7層模型的物理層中。
6.1數(shù)字?jǐn)?shù)據(jù)傳輸
數(shù)據(jù)傳輸
并行傳輸
串行傳輸
同步傳輸
異步傳輸
從一個(gè)設(shè)備向另一個(gè)設(shè)備發(fā)送數(shù)據(jù)主要考慮的是配線方式。對(duì)于配線問題主要考慮的因素是數(shù)據(jù)流。我們是否一次只發(fā)送一個(gè)比特,或是將比特成組發(fā)送以及如何成組?通過鏈路傳輸二進(jìn)制數(shù)據(jù)可以采用并行模式或串行模式。在并行模式中,在每個(gè)時(shí)鐘脈沖到來時(shí)多個(gè)比特被同時(shí)發(fā)送。在串行模式中,每個(gè)時(shí)鐘脈沖只發(fā)送一個(gè)比特。盡管只有一種發(fā)送并行數(shù)據(jù)的方法,串行傳輸卻有兩個(gè)子類:同步方式和異步方式(參見圖6-1)。
圖6-1 數(shù)據(jù)傳輸
6.1.1 并行傳輸
由0和1組成的二進(jìn)制值可以組成n比特的位組。計(jì)算機(jī)使用和生成以比特為單位的數(shù)據(jù),就像我們?cè)谟⒄Z(yǔ)會(huì)話時(shí)用詞而不是一個(gè)個(gè)的字母來交流一樣。通過分組,我們可以一次發(fā)送n個(gè)比特而不是一個(gè)比特。這稱為并行傳輸。
從概念上說,并行傳輸?shù)臋C(jī)制很簡(jiǎn)單:一次使用n條導(dǎo)線來傳輸n個(gè)比特。這種方式下,每個(gè)比特都使用專門的線路,而一組中的n個(gè)比特就可以在每個(gè)時(shí)鐘脈沖從一個(gè)設(shè)備傳輸?shù)搅硪粋€(gè)設(shè)備。圖6-2顯示了n=8時(shí)并行傳輸?shù)墓ぷ鳡顩r。通常八根導(dǎo)線被捆成一根電纜,兩端都有連接頭。
8個(gè)比特一起發(fā)送
接收方
需要8條線
s
發(fā)送方
圖6-2 并行傳輸
并行傳輸?shù)膬?yōu)勢(shì)在于速度。當(dāng)其它因素相同時(shí),并行傳輸將比串行傳輸?shù)乃俣瓤靚倍,但同時(shí)也存在一個(gè)嚴(yán)重缺點(diǎn):費(fèi)用高。為進(jìn)行數(shù)據(jù)傳輸,并行傳輸需要n條通信線路(本例中是導(dǎo)線)。因?yàn)槿绱税嘿F,所以并行傳輸通常被限制在最長(zhǎng)25英尺的距離內(nèi)。
6.1.2 串行傳輸
在串行傳輸中,比特是一個(gè)一個(gè)一次發(fā)送的,因此在兩個(gè)通信設(shè)備之間傳輸數(shù)據(jù)只要一條通信通道,而不是n條。
串行傳輸相對(duì)于并行傳輸?shù)膬?yōu)點(diǎn)是:因?yàn)橹恍枰粭l通信信道,串行傳輸?shù)牡馁M(fèi)用大約只是并行傳輸?shù)膎分之一。
因?yàn)樵谠O(shè)備內(nèi)部的傳輸是并行的,所以在發(fā)送端和線路之間以及接收端和線路之間的接口上,都需要有轉(zhuǎn)換器(前者是并/串轉(zhuǎn)換,后者是串/并轉(zhuǎn)換)。
串行傳輸以兩種方式進(jìn)行:同步方式和異步方式。
(1) 異步傳輸
如果在傳輸中信號(hào)的時(shí)序并不重要,我們就將這種傳輸稱為異步傳輸。它與同步方式不同的事,信息是以一種約定的模式來被接收和翻譯的。只要遵照約定模式,接收設(shè)備就可以以不理會(huì)信息發(fā)送的節(jié)奏而能正確獲取信息。約定模式是基于將比特組成字節(jié)。每一組比特(通常為八個(gè))作為一個(gè)單位通過鏈路傳輸。發(fā)送端系統(tǒng)單獨(dú)處理每個(gè)組,每處理完一個(gè)組就將其轉(zhuǎn)發(fā)到鏈路上,并不理會(huì)時(shí)鐘信號(hào)。
因?yàn)闆]有同步脈沖,接收方步可能通過及是方式來預(yù)測(cè)下一組比特何時(shí)到達(dá)。因而,為了通知接收方有新的比特組到達(dá),在每字節(jié)的開頭都要附加一個(gè)比特。這個(gè)比特,通常是0,被稱為起始位。為了讓接收方知道一個(gè)字節(jié)已經(jīng)結(jié)束,在每字節(jié)尾部還要加上一個(gè)或多個(gè)比特。這些比特,通常是1,被稱為停止位。利用以上的方法,每字節(jié)的大小至少增加到了10個(gè)比特,其中有8比特的信息在加上2個(gè)或更多的提示接收方的信號(hào)。另外,每發(fā)送完一個(gè)字節(jié),可能還要跟上一段可變長(zhǎng)的時(shí)間間隙。這段間隙或者通過信道控閑狀態(tài)代表,或者通過附加的停止比特流代表。
在異步傳輸中,需要在每字節(jié)開始時(shí)發(fā)送一個(gè)起始位(0),然后在結(jié)束時(shí)發(fā)送一個(gè)或多個(gè)停止位(1)。在字節(jié)之間可以插入間隙。
起始位、停止位和間隙將一個(gè)字節(jié)的起始和終止提示給接收放,使得接收方可以根據(jù)數(shù)據(jù)流進(jìn)行同步。因?yàn)樵谧止?jié)這一級(jí)別,發(fā)送方和接收方不需要進(jìn)行同步,所以這種傳輸方式稱為異步傳輸。但是在每一字節(jié)內(nèi),接受方仍要根據(jù)比特流來進(jìn)行同步。也就是說,一定程度上的同步還是存在的,但僅僅局限在一個(gè)字節(jié)的時(shí)間內(nèi)。在每一個(gè)字節(jié)的開始,接收端設(shè)備就進(jìn)行重同步。當(dāng)接收方檢測(cè)到一個(gè)起始位后,就啟動(dòng)一個(gè)時(shí)鐘,并隨著到來的比特開始記數(shù)。在接受完n個(gè)比特后,接受方就等待停止位到達(dá)。當(dāng)檢測(cè)到停止位到達(dá)時(shí),接受方在下一個(gè)起始位到達(dá)前忽略接收的所有信號(hào)。
異步傳輸意味著在字節(jié)級(jí)別以異步方式進(jìn)行,但是每比特仍需要同步,他們的時(shí)延是一致的。
相對(duì)于不需要控制信息的傳輸方式,異步傳輸由于加入了起始位、停止位以及比特流間插入了間隙而顯得慢一些。但是這種方式既便宜又有效,這兩大優(yōu)點(diǎn)使得在低速通信這一類情形下異步傳輸方式顯得很有吸引力。例如,一臺(tái)終端到計(jì)算機(jī)的連接很自然就是一種異步傳輸?shù)膽?yīng)用實(shí)例。用戶一次只敲一個(gè)字符,這在數(shù)據(jù)通信領(lǐng)域內(nèi)是十分低速的,同時(shí)還在字符之間引入了不可預(yù)計(jì)長(zhǎng)短的時(shí)間間隙。
(2) 同步傳輸
在同步傳輸中,比特流被組裝成更長(zhǎng)的“幀”,一幀包含有許多個(gè)字節(jié)。與異步方式不同的是,引入幀內(nèi)的字節(jié)與字節(jié)之間沒有間隙,需要接收方在解碼時(shí)將比特流分解成字節(jié)。也就是說,數(shù)據(jù)被當(dāng)作不簡(jiǎn)短的0、1比特流傳輸,而接收方來將比特流分割成重建信息所需的一個(gè)個(gè)字節(jié)。
在同步傳輸中,不插入起始/停止比特或間隙就將比特依次發(fā)送出去,完全有接收方負(fù)責(zé)重組比特。
因?yàn)闆]有間隙和起始/停止位,就沒有勒比特流內(nèi)部的同步機(jī)制可以幫助接收端設(shè)備在處理比特流時(shí)調(diào)整比特同步。因?yàn)樗邮諗?shù)據(jù)的準(zhǔn)備性完全依賴于接收端設(shè)備根據(jù)比特到達(dá)進(jìn)行精確的比特計(jì)數(shù)的能力,所以時(shí)序變得十分重要。
同步傳輸?shù)膬?yōu)點(diǎn)是速度快。因?yàn)樵诎l(fā)送端不需要插入附加的比特和間隙,再接收端也不需要去掉這些比特和間隙,因而在傳輸方式在類似計(jì)算幾件數(shù)據(jù)串是這樣的高速應(yīng)用中更有效。字節(jié)同步在數(shù)據(jù)鏈路層實(shí)現(xiàn)。
6.2 數(shù)據(jù)終端設(shè)備和數(shù)據(jù)電路中接設(shè)備接口
在這里必須首先分清計(jì)算機(jī)網(wǎng)絡(luò)中的兩個(gè)重要概念:數(shù)據(jù)終端設(shè)備(DTE)和數(shù)據(jù)電路終結(jié)設(shè)備(DCE)。在數(shù)據(jù)通信中經(jīng)常涉及到四個(gè)基本功能單元:兩端各有一個(gè)DTE和一個(gè)DCE。數(shù)據(jù)終端設(shè)備(DCE)將信號(hào)轉(zhuǎn)換成適用于傳輸介質(zhì)的形式并將它發(fā)送到網(wǎng)絡(luò)鏈路中。當(dāng)信號(hào)到達(dá)另一端時(shí),相反的過程將發(fā)生。
6.2.1 數(shù)據(jù)終端設(shè)備
數(shù)據(jù)終端設(shè)備(DTE)包括所有具有作為二進(jìn)制數(shù)字?jǐn)?shù)據(jù)源點(diǎn)或終點(diǎn)能力的單元。在物理層,這可以是一臺(tái)終端、一臺(tái)小型計(jì)算機(jī)、計(jì)算機(jī)、打印機(jī)、傳真機(jī)或
收藏