BUILDING a MICROCOMPUTER SYSTEM 1. OBJECT 1.1 to Design
Total Page:16
File Type:pdf, Size:1020Kb
BUILDING A MICROCOMPUTER SYSTEM 1. OBJECT 1.1 To design a microcomputer system using the Intel 80C188 microcontroller chip. 1.2 To construct and debug the hardware of the microcomputer system designed. 1.3 To develop a bootstrap loader for the microcomputer system constructed. 1.4 To use the bootstrap loader for the development of application software for the microcomputer system. 2. INSTRUCTION With advancement of semiconductor technology, the cost of microprocessors has dropped tremendously. The cost has dropped to a stage where is now considered feasible to include microprocessors as intelligent controllers in many consumer products. The development of microprocessor based system is no longer a task of a big development group in a company. Today more engineers are expected to single handedly design and implement microprocessor based systems as stand-alone intelligent controllers without the help of expensive emulator sets. The need to compete effectively also cuts the allowable turn-around time for design of such systems to a bare minimum. There is therefore a pressing need for new engineers to master the skill to systematically develop a system without expensive aids and in the shortest possible time. In this experiment, the student will be guided on the procedure to systematically develop a system for microprocessor based applications. 3. EQUIPMENT IBM compatible PC with at least one serial port Oscilloscope EPROM programmer UV eraser Soldering equipments Components as per students’ design (INTEL 80C188 based) 4. DESIGN THE HARDWARE OF A SINGLE CARD MICROCOMPUTER SYSTEM i) Study Figure 1 and the pin description of the 80C188 very carefully. The following will help you design the memory subsystem of the computer system. (a) Note that output pins are used to control the operation of external devices. You will have to study the logic function of each of the output pins to determine how they are to be used to control your devices (e.g. RAMs, ports etc.). (b) Input pins to the microprocessor are checked by the microprocessor and usually determine the subsequent operations. It is therefore very important that you find out exactly how each input pin affects the operation of your microprocessor and then bias them correctly. (c) First consider the clock generator. This is the “heart” of the microprocessor. How do you connect a crystal to provide the “heartbeat”? (d) NMI (non-maskable interrupt) - input pin. What does it mean by non-maskable? What happens if this pin is not properly biased? Note that this pin is edge triggered. It does not matter what the steady state level is. For this design, provide a push button switch to give a pulse as and when desired. (e) HOLD and HLDA. What are the functions of these two pints? What happens if they are not properly biased? (f) AD0-AD7. Multiplexed address and data bus. How to de-multiplex them? How about using a 74HC573? What is the logical function of the 74HC573? What is the purpose of the pin ALE/QSO of the microprocessor? Ho do you handle the output enable pin of the 75HC573? (g) A16-A19. Multiplexed address and status bus. Do you really need to use them? Think carefully. If you really want to make use of these pins in part II, then you have to de-multiplex them just like AD0-AD7. (h) A8-A15, address bus. For the 80C188, these are not multiplexed. (i) MCS0 to MCS3 , PCS0 to PCS4 . Chip selection pins. Read about their functions. It is useful for your part II. (j) ARDY&SRDY. What is it used for? Make sure you biased it correctly, otherwise your circuit will not work! Why? (k) RES pin. Used to reset the CPU to some initial state. What circuit would you connect to this pin? ii) Selecting the memory configuration (a) Do you need RAMs, EPROMs or both? Why? Consider the memory map of the 8088 or 80C188. Where should you put the RAMs and EPROMs in the memory map? To help you, consider the default state of CS and IP when the microprocessor is reset. These are important information and you should be able to find these information in the data sheet, books etc. This determines the location of the first instruction fetched by the CPU. Do you put RAM or EPROM at this location? Note that once the microprocessor comes out of the reset state, this location must provide the first instruction. Otherwise the microprocessor will “hang”. Next consider the locations of the interrupt vector table of the CPU. Do you put RAMs or EPROMs at these locations? With these questions correctly answered, you will be able to determine the addresses to be allocated to the RAM and EPROM chips. Subsequently, you will be able to design the address decoding circuit to select the locations in the RAM and EPROM chips. (b) At this point, you should be able to draw up a detailed logic diagram of your design. If all goes well with your thought process, your design should contain the following components; 80C188, one RAM, one EPROM, one 74H573, one 74HC04, a crystal, 2 switches, capacitors and resistors. Note that in this experiment, I have not asked you to do a proper analysis of timing and drive requirements. I had checked these for you and ordered the appropriate components. However in your future designs, you will have to ensure that timing and drive requirements are fulfilled. iii) Connecting up your circuit (a) Insert the IC sockets into the circuit board and secure them at 2 points each. Insert an IC pin reference card for each IC socket. (b) Connect the power supply lines for all your chips. Decouple your power lines at each IC. Why? You will need a capacitor of higher value for your 80C188 chip. (c) Connect up the crystal for your microprocessor. Check that your clock is working. How? Examine the signals at the following pins, X1, X2, CLKOUT. (d) Properly bias all the input lines to the microprocessor. Note that you have a R-C circuit connected to your RESET and NMI pins. Apply power to your circuit and check the CLKOUT of the 80188. Note that unless you are sure that what you see at the CLKOUT is correct, do not proceed to wire up the rest of the circuit. (e) Connect up your address/data de-multiplexer, address decoder circuit and memory chips. This should take about 2 hours or so. Ensure that the circuit is soldered carefully (no shorts). It is wiser to invest more time doing a neat job here than to have lots of headache debugging the circuit later. (f) If no mishap occurs along the way, you should be at this point in about 5 hours. We are now ready to move on to write the bootstrap loader for your stand-alone microcomputer system. 5. WRITING THE BOOTSTRAP LOADER SOFTWARE i) Introduction Once the hardware is up, the next task is to write the application software and somehow gets the hardware to run it. On a PC, this process is in a way automated and transparent to you. This is because the PC has an operating system which takes care of the loading and starting tasks. However, on a stand-alone system like what you have just constructed, you are responsible for these tasks. One obvious way that you can do is of course write the application software, compile it to the binary image, burn it onto the EPROM, pluck in the EPROM to your system, power up the system and hope that all goes well. If it is a simple 2-3 pages program you are writing, this will probably take 10-20 iterations. If it is anything longer, you will probably run out of patience before you complete the task. This in a way forces us to look at ways to do soft loading instead of hard loading. In this experiment, we will look at a bootstrap loader to perform the soft loading. In this experiment we will use the PC as an extension of our hardware card for software development. The overall concept of the scheme is shown in Figure 2. The PC is linked electrically to your hardware card via a RS-232C serial link. Check that on the side of the PC, it is just transmit, receive and ground of either COM1 or COM2. On the side of your hardware card, it is just the transmit, receive and ground of the 80C188. Of course for RS-232C, the communication voltages are +/-15 volts. A 5V to +/-15 V converter has been designed in the circuit to convert the voltages. With the above hardware connection and the bootstrap loader residing in the EPROM, you can now write the source code of your application program on the PC. This source code can be compiled into the binary image on your PC. Once that is done, you can run one of the serial port service software such as VTERM.EXE HYPERTERMINAL to send the binary image of the application program to the hardware card you had constructed. Note that there is no absolute necessity to use VTERM.EXE or HYPERTERMINAL. You can even write your own COM port service routine. It is not that difficult. On the side of the hardware card, we know that the image of some application software is coming through the serial line. What the bootstrap loader needs to do is to continually check the serial port for data received. If data is received, it will put them at the appropriate place in memory. Once the file transfer is completed, it will transfer control by making a jump to the appropriate starting location.