Monday, April 1, 2019

Design of Handshake Mode

Design of trill ModeDesign Of Handshake Mode 8255A Using 8086Introduction8255 is a widely pulmonary tuberculosis oecumenic purpose programmable thingummys, smoke be compatible with any micro mainframe. The 8255 includes trio programmable styles, bingle of which butt joint be utilization for bidirectional selective in entropy formattingion pitch. This is an im mienant superfluous feature in comparison with the 8155 I/O appearances. The 8255 has 24 I/0 declines that piece of tail be root worded primarily in twain 8 stain par some(prenominal)el demeanors. A B, with the remaining eight microchips as way c. the eight looks of embrasure c deal be employ as individual crooks or be grouped in cardinal 4- crook ways. The mental image shows tot completelyy the personas of 8255, classified match to devil styles the BSR means and I/P system. The BSR way of life is utilize to put or specify the consequences in port c. the I/O panache is further divided into trey dashs mode 0, mode 1 and mode 2. In mode 0, solely the ports function as simple I/O ports. Mode 1, is a milkshake mode w here by ports A and/or B utilise bends from port C as handclasp houses. In the milkshake mode, two emblems of I/P info butt be guidered implemented stead turn back and expose. In mode 2, port A can be sight up for bidirectional entropy transfer using shingle designates from port C, and port B can be used to great deal up either in mode 0 or mode 1.Programmable Parallel Ports And Handshake Input/OutputWe use port kinks to gossip entropy and rig selective information to the microcentral processing unit. Most of the available port devices such as 8255A on the sdk-86 board, contain two or three ports which can be programmed to head for the hills in hotshot of the several distinguishable modes. The different modes surrender us to sympathise for many common types of double entropy transfer. Various methods of reduplicate remark information transfer atomic number 18 elementary Input/OutputWhen we drive to get the digital data from a simple switch such as thermostat into a microprocessor all we do is that we connect the switch to an scuttlebutt port greenback and accept it any metre. Similarly when we need to end product the data to a simple outturn device such as an LED, all we do is to connect the light-emitting diode buffer on an make port pin and return the logical carcass level required to turn on the light. The led is always in that respect and show upy, so you can engineer data to it at any period. simplex Strobe I/OIn many applications, effectual data is present on an external device only at a certain time, so it must be read in at that time. An guinea pig of this is the ascii-en encryptd keyboard. When key is pressed. Circuitry on the key board moves out the ascii code for the pressed key on eight parallel data overseas telegrams, and hence sends out a strobe maneuver o n an other line to intimate the valid data is present on the eight data lines. As shown in public figure-4.9 we can connect this strobe line to an enter port line and poll it to determine when we can put valid data from the keyboard. A nonher alternative is to connect the strobe line to an disperse input of the processor and have an violate service purpose read in the data when the processor receives an bankrupt. The point here is that this transfer is time dependent. We can read the data only when a strobe pulsing tells us that the data is valid.Fig 9 1b shows the timing waveforms which represent this type of operation. The send device such as a keyboard, outputs parallel data on the data lines, and then outputs at the stb signboard to let us know that the valid data is present. For low rates of data transfer such as from a keyboard to a microprocessor, a simple strobe transfer works well. However for grittyer data transfer velocity this method does not work because there is no signal which tells the direct device when it is safe to send the neighboring data byte. In other develops, he sending system faculty send data bytes windy than the receiving system could read them. To prevent this problem a shiver data transfer scheme is used.Single-Handshake I/Ofigure 9-2 shows the circuit connections and figure 91-c shows some example timing waveforms for a handshake data transfer from a fringy device to a microprocessor. The peripheral device outputs some parallel data and sends stb signal on a polled or interrupt foundation garment and reads in the byte of data. Then the microprocessor sends a acknowledgement signal to the peripheral to indicate that the data has been read and the peripheral can send the adjacent byte of data from the view point of the microprocessor this operation is referred to as handshake or strobe input. These resembling wave forms might represent a handshake output from a microprocessor to parallel wisespaperwoman. In t his case the microprocessor outputs a caliber to the newspaperwoman and asserts an stb signal to the correspondent to tell the printer , here is a character for you. When the printer is restore it answers back with ack signal to tell the microprocessor, I got that bingle send me another. The point of this handshake scheme is that the sending device or system is designed so that it does not send the next data byte until the receiving device or system indicates with an ack signal that it is ready to receive the next byte.Double-Handshake Data enraptureFor data transfers where even more coordination is required between the sending system and the receiving system a double handshake is used the sending device asserts its stb line low to ask be you ready? the receiving system raises its ack line high to say I m ready. The peripheral device then sends the byte of data and raises its stb line high to say I have the data thank you. And I wait your next postulation to send the ne xt byte of data. For handshake output of this type from a microprocessor to a peripheral the waveforms be the same but the microprocessor sends the stb signal and the data the peripheral sends the ack signal. In the accompanying laboratory manual it is shown hoe to interface with a speech-synthesizer device using this type of handshake system.Implementing Handshake Data TransferFor handshake data transfer a microprocessor can determine when it is time to send the next data byte on a polled or interrupt innovation. The interrupt approach is ordinarily used because it makes better use of the processors time. The stb or ack signal for these handshake transfers can be make believed on a port pin by commandments in the program. However this method usually uses too much processor time, do parallel port devices such as the 8255A have been designed to automatically manage the handshake operation. The 8255A for example can be programmed to automatically receive an stb signal from a peri pheral, send an interrupt signal to the processor and send the ack signal to the peripheral at the proper times.8255A Internal Block Diagram And System ConnectionsThe diagram shows the informal structure of the 8255A. form the diagram it is observed that there atomic number 18 24 input output lines. Port A can be used as an 8 smear input port or as an output port. Like port B can be used as an 8 bit input port or as an 8 bit output port. Port C can b used as an 8 bit input output port or as 4 bit port or to produce handshake signals for ports a nd b. the signal lines used to connect to the device to the system busses. 8 data lines allow us to write data bytes to a port or the see to it charge and to read bytes from the port or the status file away under the swayler of the rd wr lines. The call collide with inputs A0 and A1 allow us to selectively access peerless of the three ports or the suss out immortalise. The internal encompasses for the device are port A 00, port B, 01 port C10 admit, 11. Asserting the cs input of the8255A modifys it for reading or writing. The cs input bequeath be affiliated to the output of the address decoder circuitry to select the device when it is addressed. The readapt input of the 8255A is affiliated to the system define line so that, when the system is reset all the port lines are formatd as input lines.this is make to prevent destruction of circuitry connected to port lines. If port lines are initialised as outputs after a agency up or reset the port might try to output to the output of the device connected to the port. The possible argument between the two outputs might destroy one or both of them. Therefore all the programmable port devices initialize their port lines as inputs when reset. The given figure shows that how a 8255 can be connected to a 8086, here one 8255 is connected to the lower one-half of the 8086 data bus and the other is conneceted to the upper half of the 8086. This is done so that byte can be transferred by enabling one device, or a sound out can be transferred by enabiling both devices at the same time. fit in to truth table for the input output port address decoder the A40 8255A on the lower half of the data bus ordain be enabled for a base address of FFF8H, and the A35 8255A will be enabled for a base address of FFF9H. another point to vizor is that system address line A1 is connected to the 8255A A0 inputs, and system address line A2 is connected to the 8255A A1 inputs. With these connections the system address for the three ports and the pick up register in the A 40 8255A will be FFF8H, FFFAH, FFFCH, FFFEH. Likewise the system address for three ports and the keep in line register of the A 35 8255A are FFF9H, FFFBH, FFFDH, and FFFFH.8255a available Modes And Initiallization personal manner 0When we trust to see the port for simple input or output without handshaking we initialize the port in mode 0. If both port A and port B are initialized in mo de 0, then the two halves of port c can be used together as an additional 8-bit port or they can be used distributively as two 4 bit ports. When used as outputs, the port c lines can be individually set or reset by sending a additional control script to the control register address. The two halves of port C are independent so one half can be initialized as input and the other half as output.MODE 1When we neediness to use port A or port B for handshake input or output operation. We initialize that the port in MODE 1. In this mode some of the pins in port C function as handshake lines. Pins PCO, PC1 and PC2 function as handshake lines for port B if it is initialized in MODE1. If port A is initialized as handshake mode input port then pins PC3,PC4,and PC5 function as handshake signals. Pins PC6 and PC7 are avalible for use as input lines and output lines. If port A is initialized as a handshake output port, then port c pins PC3,PC6,PC7 function as handshake signals. Port c pins PC4 and PC5 are available for use as input or output lines. Since the 8255 often used in mode 1.MODE 2Only port a can be initialized in mode 2 port a can be used for bidirectional handshake data transfer. This means that data can be output or input on the same eight lines. The 8255A might be used in this mode to occur the system bus to slave microprocessor or to transfer data bytes to and from a floppy disk controller board. If port A is initialized in MODE 2 then PINS PC3 through PC7 are used as handshake lines in port A. the other three pins PC0 through PC2 can be used for input output if port B is in mode 0. The three pins will be used for port B handshake lines if port b is initialized in mode 1.Constructing And Sending 8255A Control rowingFigure 9-5 shows the formats for the two 8255A control quarrel. Note that the msb of the control member tells the 8255A which control word your are sending it. We use the mode explanation control word format to tell the device what modes we w ant the ports to operate in. we use the bit set /reset control word format . we want to set or reset the output on a pin of port c or when we want to enable the interrupt output signals for the handshake data transfers. Both control words are sent to the control register address of the 8255A. as usual, initializing a device such as this consists of working our way through the steps as described already. As an example for this device suppose that we want to initialize the 8255A in figure 7-8 as follows.Port B as mode 1 inputPort A mode 0 outputPort C upper as inputsPort C bit 3 as outputThe base address of the A40 8255A is FFF8H, and the control register address is FFFEH. The next step is to make up the control by figuring out what to put in each of the little boxes, one bit at a time. Figure 9-6a shows the control word which will program the 8255A as desired for this example. The figure alsi shows how we should document any control words to make for use in our programs using figure 9-5 a work our way through this word to make sure we see why each bit has the value it does. To send the control word we load the control word in AL with a MOV AL,10001110B command point DX at theport address with the MOV DX,0FFFEH tuition and send the control word to the 8255A control register with the out DX, AL instruction. An example of how to use the bit set/reset control word suppose that we want to output a 1 to (set) bit 3 of port c, which was initialized as an output with the mode set control word above. To set or reset a port c output pin, we use the bit set/reset control word shown in figure. Make bit d7 to 0 to identify this as a bit set/reset control word and put a 1 in bit d0 to specify that we want to set a bit of port c. bits d2 d3 and d1 are used to tell the 8255A which bit we want to act on. For this example we want to set bit 3 so we put 011 in these three bits. For simplicity and compatibility with future products make the other 3 bits of the control words 0. T he result 00000111B is shown with proper documentation in the figure. To send this control word to the 8255A simply load it into AL with the MOV AL,00000111B instruction, point dx at the control register address with the MOV DX ,0FFFEH instruction if DX is not already pointing there, and send the control word with the OUT DX,AL instruction.8255A Handshake- Interfacing To A Micro information processing system- Controlled LatheAll the machines in the machine shop of our computer controlled electronics factory operate under microcomputer. One example of these machines is a lathe which makes bolts for ample rods of stainless steel. The cutting instructions of each type of bolt that we need to make are stored on in wode teletype like metal read. all(prenominal) instruction is represented by a series of holes in the mag commemorate. A magnetic show reader pulls the through an optical or mechanical demodulator to detect the hole patterns and converts these to an 8 bit parallel co de. The microcomputer reads the instruction codes for the put down reader on a handshake basis and sends the fascinate control instructions to the lathe. The microcomputer must also monitor several(a) conditions around the lathe. It must, for example make sure the lathe has cutting lubricant oil, is not out of material to work on, and is not jammed up in some way. Machines that operate in this way are often referred to as computer numerical control or CNC machines.The figure given shows from how we might use an 8255A to interface a microcomputer to the read reader and lathe. Our eldest task is to make up the control word which will initialize the 8255A In the correct modes for this application. To do this start by making a list showing how we want each port or group of pins to function. Then put in the control word bits that implement those pin functions.Port A needs to be initialized for handshake input ( mode 1 ) because instruction codes have to be read in from the tape read er on the handshake basis.Port B needs to be initialized for simple output (mode 0) no handshaking is needed here because this port is being used to output simple on or off control signals to the lathe.Port C , bits pc0 pc1 and pc2 are used for simple input of sensor signals for the lathe.Port C bits pc3 pc4 and pc5 function as the handshake signals for the data transfer from thr tape reader connected to port A.Port C bit pc6 is used for output of the stop/go signal to the tape reader.Port C bit pc7 is not used for this example.Figure 9-b shows the control word to initialize the 8255A for these pin functions. We send this word to the control register address of the 8255A.In order for the handshake input data transfer from the tape reader to work correctly , the interrupt request signal from bit pc3 has to be enabled. This is done by sending a bit set/reset control word for the appropriate bit of port c. fig 9-9 shows the port c bit that must be set to enable the interrupt output sig nal for each of the 8255A handshake modes. For example here port A is being used for handshake input, so according to figure 9-9 port C bit pc4 must be set to enable the interrupt output for this operation. The bit set/reset control word to do this is 00001001B. we send this bit set/reset control word to the control address of the 8255A.Handshake data transfer from the tape reader to the 8255A can be stopped by disabling the 8255A interrupt output on port C, pin c3. This is done by reseting bit pc4 with a bit set/reset control word of 00001000. As another example of 8255A interrupt output enabling suppose that we are using port B as handshake output port. According to figure 9-9 we need to set bit pc2 to enable the 8255A interrupt output signal. The bit set/reset control word to do this is 00000101. directly we see how the actual data transfer takes place in handshake mode for which the machine would operate.After initializing everything we would probably read port C, bits pc0 pc1 and pc2 to check if the lathe was ready to operate. For any 8255A mode we read port C by simplt going an input from the port C address. Then we output a start command to the tape reader on the bit pc6.this is done with a bit set/reset command. Assuming that we want to reset bit pc6 to start the tape reader, the bit set/reset control word for this is 00001100. When the tape reader receives the go command. It will start the handshake data transfer to the 8255A.The tape reader starts the process by sending out a byte of data by sending out a byte of data to port A on its eight data lines. The tape reader then asserts its stb line low to tell the 8255A that a new byte of data has been sent. In response the 8255A raises its input buffer full (IBF) signal on pc5 high to tell the tape reader that it is ready for the data. When the tape reader detects the IBF signal at a high level, it raises its stb signal high again. The rising edge of the stb signal has two effects on the 8255A. it depr ession latches the data byte in the input latches of the 8255A. once the data is latched the tape reader can remove the data byte in preparation for sending the next data byte. This is shown by the dashed section on the right location of the data waveform in figure. The rising edge on the stb signal will cause the 8255A to output an interruot request signal in the microprocessor on bit pc3.The processors response to the interrupt request will be to go to an interrupt service procedure which reads in the byte of data latched in port A. when the RD signal from the microprocessor goes low for this read of port A, the 8255A will automatically reset its interrupt request signa on pc3. This is done so that a south interrupt cannot be caused by the sane data transfer, when the processor raises its RD signal high again at the end of the read operation, the 8255A automatically drops its IBF signal on pc5 low again. IBF going low again is the signal to the tape reader that the data transfer is complete and that it can be send the next byte of data. The time between when the 8255A sends the interrupt request signal and when the processor reads the data byte from port A depends on when the processor gets around to armed service that interrupt. The point here is that this time doesnt matter. The tape reader will not send the next byte until it detects the IBF signal has gone low again. The transfer circle will then repeat for the next data byte. After the processor reads in the lathe control instruction byte from the tape reader, it will decode this instruction and output the appropriate control byte to the lathe on port B of the 8255A. the tape reader then sends the next instruction byte. If the instruction tape is make into a continuous loop, the lathe will keep making the specified move until it runs out of material. The unused bit of port c , pc7 could be connected to a mechanism which loads In more material so the lathe can continue.Parallel Printer InterfaceHand shake Output exemplificationThis refers to the hardware connections and the software required to interface with a parallel printer in a system which does not have a BIOS procedure we can all to do the job. For most common printers such as IBM pc printers, the Epson dot matrix printers data to be printed is sent to the printers, and the Panasonic dot-matrix printers data printed is sent to the printer as ASCII characters on eight parallel lines. The printer receives the characters to be printed and stores them in an internal RAM buffer. When the printer detects a act carriage return, It prints out the second row of characters, etc. the process continues until all the desired characters have been printed.Transfer of the ASCII codes from a microcomputer to a printer must be done on a handshake basis because the microcomputer can send characters much faster than the printer can print them. The printer must in some way let the microcomputer know that its buffer is full and that it cann ot accept any more characters until ir prints some out. A common standard for interfacing with parallel printers is the centronics parallel interface standard, named for the company that developed it.ReferencesMicroprocessors and interfacing programming and hardware second variant by Douglas V. Hall TATA McGRAW-hill edition.Microprocessor architecture, programming, and applications with the 8085 by Ramesh Gaonkar fifth edition, penram international publicationFundementals of microprocessor and microcomputers byB. Ram, Dhanpat Raipublication.

No comments:

Post a Comment