1、 1 外文资料 Data Transfer Techniques The actual transfer of data between the microcomputer and external and external devices is commonly carried out using three different techniques: ( 1) ling;( 2) errupters; (3)emory access;These techniques can be used individually or in combination. Polling Polling ro
2、utines are used for programmed input/output purposes.A number of peripheral devices attached to the microcomouter are continuously polled at specified time intervals to determine the device wishes to input data to the microproccssor. Similarly, for the transfer of data to an output device,the state
3、of its buffer is checked to determine if it is empty and ready to receive the data. A soft program is required to check the state of the peripheral devices. Hardware flaga are used to indacate the send or receive condition of the peripheral. If a device is ready to transfer the data, then an appropr
4、iate software routine is used to service that particular device so that data transfer can take place .It is necessary to ensure that none of the data from any of the peripherals are lost while the polling routines or any the peripheral devices servicing routines are being executed. The probability o
5、f loseing data is very small since most perpheral are slow deices. Other techniques, such as direct memory access(DMA) , can be used to achieve high-speed data transfer from a given peripheral. Polled input/output is very simple and common method of data transfer which does not require any additiona
6、l logic circuitry.The only requirement is for an efficient program which is executed at very high speed. Interrupted Intput/output The polling procedure is a form of time-sharing whereby the facilities of the computer are shared between a numbers of uses. The computer continually polls each of the t
7、erminals, and serves a terminal for a specified period of time before moving on to the next one. This procedure is inefficient because system overheads are incurred in polling all the perpheral devices irrespective of the actual need. The time available for the processing of the real-time requiremen
8、ts of process control system in which a particular device might require urgent attention while the processor is servicing another input/output device. In some circumstances the actual data might be lost. These difficulties can be overcome by using the hardware interrupt input/output system. The outp
9、ut of the microcomputer system can be increased substantially by using such interrupts, since an input/output device is serviced only after it indicates that it is ready to send or receive data.This request for input/output can occur at any time, i.e. in an asynchronous mode,and the devices indicate
10、s this by seting up an interrupt flag. The microprocessor acknowledges the interrupt, completes the execution of the current 2 instruction, saves the content of the registers and then servieces the requesting devices by transferring control to an appropriate intput/output routine. Once the periphera
11、l device has been serviced, the control is transferred back to the original program which resumes execution from the point at which it was interrupted. Some real-time control applications involve the use of critical programs which must not be interrupted during their execution. Some of the interrupt
12、ed are trivial which others have to be serviced. For example, data input can be delayed which alarms muse be raised immediately.Differernt types of interrupts, maskable and non-maskable,can be used to overcome these difficulties. Software programs are used to enable or disable a maskable interrupt.
13、Thus,if the maskable interrupt. Thus, if the maskable interrupt has been disabled,the microprocessor will ignore the interrupt request. A non-maskable interrupt has to be acknowdged and serviced by the microprocessor. The interrupt used in a microprocessor system might be a fixed interrupt or a vect
14、ored interrupt. A fixed interrupt requires relatively simple hardware. The flag is set on the interrupt line to indicate that service is required. If there is only one device attached to interrupt line ,then the control will be transferred to a fixed memory location which provide the program for ser
15、vicing that device. When a number of of devices are attached to a given interrupt line, each with its own servicing routine, then the peripheral responsible for the interrupt has to be identifed. Thus a polling routine examination must be used to detect the peripheral requiring service and then dete
16、rmine the memory location at which the program for servicing that device starts. Multiple interrupt lines can be used tovercome these difficulties. Interrupts with multiple lines provide the addresses of different memory locations to which the program should transfer in response to an interrupt on a
17、 particular It would be necessary to use as many lines as the number of interrupts or resort to polling routines if more than one device is attached to the same interrupts line . A preferred alternative is to use a vectored interrupt whereby the interrupting device is directly identifed .This device
18、 identification can be used to to look up the starting memory location of the service routine for that device. Some vectored interrupts not only identify the interrupting device,butalse provide the starting memory location of the service routine to which the program should jump.Thus the address of t
19、he memory location, stored in the peripheral controller ,is placed on the data bus and used for transfering the controller. A system with only one device which can interrupt the normal work of the microcomputer is a very simple one and the particular interrupt can be readily serviced. In practice a
20、large number of devices can provide interrupt requests to the microcomputer .Under normal circumstances, it is likely that two or more devices may provide an interrupt request at the same time.It then becomes necessary 3 to decide the priority to be allocated to individual interrupt request .A numbe
21、r of procedures can be used for priority allocation purposes. Priorities can be allocated to peripherals attached to a single interrupt line by using a simple daisy chain procedure. Once interrupt, the microcomputer sends a signal to the first device in the daisy If it is the interrupting device ,th
22、en it will provide the memory address of its service routine and the signal will not be passed on to the other way round devices in the daisy chain. If, however ,the first device did not cause the interrupt,then the massage will be passed on to the next device. This procedures is repeated until the
23、interrupting device is located. Clearly the first floor device in the daisy chain will have highest priority ,followed by the next one and so on. Once an interrupt request has been acknowledge and is being serviced all the other interrupt either have to be disable or higher priority interrupts must
24、be allowed to break into the current service routine . An alternative to daisy chains is to use priority interrupt circuits which identify and service the device with highest priority. Level 0 means highest priority,followed by level 1, level 2 and so on. These priority interrupt circuits identify u
25、p to 8 interrupt level by means of a 3-bit code which can be inspected by the microprocessor.Since event such as power failure must be identified quickly and alarms must be raised as soon as possible, these sub-systems are attached to higher priority interrupts. Similarly, other peripherals requirin
26、g fast response can be alloacted higher priority than slow-speed peripherals. Facilities exist for the programmer to mask selectively one or more interrupt levels. When an interrupt is being serviced and another interrupt tasks place, then the priority of the new interrupt is compared with the prior
27、ity of the existing interrupt. A higher priority interrupt is allowed to suspend the servicing of the current interrupt, otherwise the lower priority interrupt will until the higher priority one has serviced. Some of the currently available priority interrupt circuits carry out far more than the ide
28、ntification of the highest priority device which requires attention. Then will also provide the address of the memory location to which the control should be transferred. If two interrupts occur simultaneously, the device serviced by the microcessor program has the higher priority. Direct Memory Acc
29、ess While interrupted input/output throughput rate is higher than the throughput applications requiring fast data transfering. Direct memory access (DMA) techniques bypass the central processing unit and substantially increase the data transfer rate which can be as high as the memory cycle time allo
30、ws. The other limiting factor is the speed of the peripheral device. This technique can be used to write data required at high speeds or for transfers between the memory and the mass storage devices attached to the microcomputer. DMA involves the isolation of all devices, other than the single device to be used to for data transfers, from the memory which the data trantsfer between the memory and