The Microcontroller Architecture, Programming And erothbridunin.tk If looking for the ebook microcontroller solution manual by ayala in pdf ayala. The Microcontroller Architecture, Programming And erothbridunin.tk architecture, programming, and applications / Kenneth J. Ayala. p. cm. Ayala, Kenneth J. The microcontroller: architecture, programming, and applications / Kenneth J. Ayala. p. cm. Includes index. ISBN (soft). 1.
|Language:||English, Japanese, German|
|Genre:||Academic & Education|
|ePub File Size:||27.85 MB|
|PDF File Size:||8.82 MB|
|Distribution:||Free* [*Registration Required]|
Page 1. TIHOMSON. The Microcontroller. U(O). Ayala. Page 2. Page 3. Page 4. Page 5. Page 6. Page 7. Page 8. Page 9. Page Page Page The Microcontroller Kenneth J Ayala - Ebook download as PDF File .pdf) or read book online. microcontroller pdf. TIHOMSON. The Microcontroller. U(O). Ayala A by-product of microprocessor development was the microcontroller. The same fab- rication techniques.
WordPress Shortcode. BarbaraWilkerson2 Follow. Published in: Full Name Comment goes here. Are you sure you want to Yes No. Be the first to like this. No Downloads. Views Total views.
Actions Shares. Embeds 0 No embeds. No notes for slide. You can get the manual you are interested in in printed form or perhaps consider it online. You can read the content preview on the table of content below in case obtainable , that is start from the Introduction, Brief Description till the Reference page. For these users, I would recommend the download of complete boards that have the electrical design completed and clear directions as to how to interface common I 1 0 circuits.
Many people have played a part in writing this book. Special thanks go to all of the following people: The reviewers of the early, really rough, drafts of the text: Moore, Staff Applications Engineer for Intel Corporation in Chandler, Arizona, whose meticulous comments have greatly improved the technical accuracy and readability of the text.
Tom Tucker of West Publishing for his willingness to experiment. Anne, my wife, for many years of patience and understanding. My students, past and present, who have taught me much more than I have taught them Finally, let me thank you, the reader.
I would be very grateful if any errors of omission or commission are gently pointed out to me by letter or telephone. Thank you for your help. Kenneth J. Ayala Western Carolina University Cullowhee. Born of parallel develop- ments in computer architecture and integrated circuit fabrication, the microprocessor, or "computer on a chip," first became a commercial reality in with the introduction of the 4-bit by a small, unknown company by the name of Intel Corporation.
Other, more well-established, semiconductor firms soon followed Intel's pioneering technology so that by the late s one could choose from a half dozen or so microprocessor types.
The s also saw the growth of the number of personal computer users from a handful of hobbyists and "hackers" to millions of business, industrial, governmental, defense, educational, and private users now enjoying the advantages of inexpensive computing. A by-product of microprocessor development was the microcontroller. The same fab- rication techniques and programming concepts that make possible the general-purpose microprocessor also yielded the microcontroller.
Microcontrollers are not as well known to the general public, or even the technical community, as are the more glamorous microprocessors. TVs, automobiles, toys, vending machines, copiers.
The remainder of the book will study one of the most popular types, the 1, in detail. Microprocessors and Microcontrollers Microprocessors and microcontrollers stem from the same basic idea, are made by the same people. What is the difference between the two? Microprocessors A microprocessor, as the term has come to be known, is a general-purpose digital com- puter central processing unit CPU. Although popularly known as a "computer on a chip," the microprocessor is in no sense a complete digital computer.
Figure I. I shows a block diagram of a microprocessor CPU, which contains an arith- metic and logic unit ALU , a program counter PC , a stack pointer SP , some working registers, a clock timing circuit, and interrupt circuits. To make a complete microcomputer, one must add memory, usually read-only pro- gram memory ROM and random-access data memory RAM , memory decoders, an oscillator, and a number of inputloutput devices, such as parallel and serial data ports.
Additionally, special-purpose devices, such as interrupt handlers, or counters, may.
Arithmetic Logic Unit. The key term in describing the design of the microprocessor is "jieneral-plrrpose. The internal CPU architecture, as well as the resultant machine level code that operates that architecture, is comprehensive but as flexible as possible. The prime use of a microprocessor is to fetch data, perform extensive calculations on that data, and store those calculations in a mass storage device or display the results for human use.
The programs used by the microprocessor are stored in the mass storage de- vice and loaded into RAM as the user directs. A few microprocessor programs are stored in ROM. The ROM-based programs are primarily small fixed programs that operate pe- ripherals and other fixed devices that are connected to the system.
The design of the mi- croprocessor is driven by the desire to make it as expandable as possible, in the expecta- tion of commercial success in the marketplace. Microcontrollers Figure 1. The design incorporates all of the features found in a microprocessor CPU: It also has added the other features needed to make a com- plete computer: RAM, parallel , serial , counters, and a clock circuit.
Like the microprocessor, a microcontroller is a general-purpose device, but one which is meant to fetch data. Interrupt Circuits. The prime use of a microcontroller is to control the operation of a machine uslng a fixed program that is stored in ROM and that does not change over the lifetime of the system.
The design approach of the microcontroller mirrors that of the microprocessor: The microprocessor design accomplishes this goal by having a very flexible and extensive repertoire of multi-byte instructions.
These instructions work in a hardware configuration that enables large amounts of memory and I 1 0 to be con- nected to address and data bus pins on the integrated circuit package. Much of the activity in the microprocessor has to do with moving code and data words to and from e. The architecture features working registers that can be programmed to take part in the memory access process, and the instruction set is aimed at expediting this activity in order to improve throughput.
The pins that connect the microprocessor to external memory are unique, each having a single function. Data is handled in byte, or larger, sizes.
The microcontroller design uses a much more limited set of single- and double-byte instructions that are used to move code and data from infernal memory to the ALU. Many instructions are coupled with pins on the integrated circuit package; the pins are "pro- grammable"-that is, capable of having several different functions depending upon the wishes of the programmer. The microcontroller is concerned with getting data from and to its own pins; the ar- chitecture and instruction set are optimized to handle data in bit and byte size.
Comparing Microprocessors and Microcontrollers The contrast between a microcontroller and a microprocessor is best exemplified by the fact that most microprocessors have many operational codes opcodes for moving data from external memory to the CPU; microcontrollers may have one, or two.
Micro- processors may have one or two types of bit-handling instructions; microcontrollers will have many. To summarize. The microcontroller can function as a computer with the addition of no external digital parts; the microprocessor must have many additional parts to be operational. To see the differences in concept between a microprocessor and a microcontroller. Note that the point here is not to show that one design is "better" than the other; the two designs are intended to be used for different purposes and in different ways.
For ex- ample, the has a very rich instruction set. The penalty that is paid for this abundance is the number of multi-byte instructions needed, some 71 percent of the total number. Each byte of a multi-byte instruction must be fetched from program memory, and each fetch takes time; this results in longer program byte counts and slower execution time versus single-byte instructions.
The has a 62 percent multi-byte instruction content; the program is more compact and will run faster to accomplish similar tasks. The disadvantage of using a "lean" instruction set as in the is increased pro- grammer effort expense to write code; this disadvantage can be overcome when writing large programs by the use of high-level languages such as BASIC and C, both of which are popular with system developers.
The price paid for reducing programmer time there is always a price is the size of the program generated.
The 8051 Microcontroller Kenneth J Ayala
A Microcontroller Survey Markets for microcontrollers can run into millions of units per application. At these vol- umes the microcontroller is a commodity item and must be optimized so that cost is at a minimum. Semiconductor manufacturers have produced a mind-numbing array of designs that would seem to meet almost any need. Some of the chips listed in this section are no longer in regular production, most are current, and a few are best termed "smokeware": Four-Bit Microcontrollers In a commodity chip, expense is represented more by the volume of the package and the number of pins it has than the amount of silicon inside.
To minimize pin count and pack- age size, it is necessary that the basic data word-bit count be held to a minimum, while still enabling useful intelligence to be implemented. Although 4 bits. The following table lists representative models from major manufacturers' data books.
Many of these designs have been licensed to other vendors. Model Pins: FIMCS40 COP MSM TMS TLCS47 These 4-hit microcontrollers are generally intended for use in large volumes as true I -chip computers; expanding external memory, while possible, would negate the cost ad- vantage desired.
Typical applications consist of appliances and toys: Eight-Bit Microcontrollers Eight-hit microcontrollers represent a transition zone between the dedicated, high volume, 4-bit microcontrollers. Eight bits has proven to be a very useful word size for small computing tasks.
Ca- pable of decimal values, or quarter-percent resolution.
Most integrated circuit memo- ries and many logic functions are arranged in an 8-hit configuration that interfaces easily to data buses of 8 bits. Application volumes for 8-bit microcontrollers may be as high as the 4-bit models, or they may be very low. Application sophistication can also range from simple appliance control to high-speed machine control and data collection.
For these reasons. The purpose of this diversity is to offer the designer a menu of similar devices that can solve almost any problem. Many times the ROM version is never used. As a further enticement for the downloader, some families have members with fewer external pins to shrink the package and the cost; others have special features such as analog-to-digital AID and digital-to-analog DIA converters on the chip. The 8-bit arena is crowded with capable and cleverly designed contenders; this is the growth segment of the market and the manufacturers are responding vigorously to the marketplace.
Each entry in the table has many variations; the total number of configurations available exceeds a total of eighty types for the eleven model numbers listed. Z Sixteen-Bit Microcontrollers Eight-bit microcontrollen can be used in a variety of applications that involve limited cal- culations and relatively simple control strategies. As the requirement for faster response and more sophisticated calculations grows, the 8-bit designs begin to hit a limit inherent with byte-wide data words.
One solution is to increase clock speeds; another is to increase the size of the data word.
The 8051 Microcontroller Kenneth J Ayala
Sixteen-bit microcontrollers have evolved to solve high-speed control problems of the type that might typically be confronted in the control of ser- vomechanisms, such as robot arms, or for digital signal processing DSP applications. The designs become much more focused on these types of real-time problems; some generality is lost, but the vendors still try to hit as many marketing targets as they can.
The following table lists only three contenders. Mndel Pins: H HPC The pulse width modulation PWM output is useful for controlling motor speed; it can be done using software in the 8-bit units with the usual loss of time for other tasks. The and bit controllers have also been designed to take advantage of high- level programming languages in the expectation that very little assembly language pro- gramming will he done when employing these controllers in sophisticated applications.
Thirty-Two Bit Microcontrollers Crossing the boundary from 16 to 32 bits involves more than merely doubling the word size of the computer. Software boundaries that separate dedicated programs from super- visory programs are also breached. Thirty two bit designs target robotics, highly intelli- gent instrumentation, avionics, image processing, telecommunications, automobiles, and other environments that feature application programs running under an operating system.
The line between microcomputers and microcontrollers becomes very fine here. The design emphasis now switches from on-chip features, such as RAM, ROM, timers, and serial ports, to high-speed computation features. The following tahle provides a general list of the capability of the Intel All of the functions needed for , data communications, and timing and counting are done by adding other specialized chips.
This manufacturer has dubbed all of its microcontrollers "embedded controllers," a term that seems to describe the function of the bit very well. Development Systems for Microcontrollers What is needed to be able to apply a microcontroller to your product? That is, what pack- age of hardware and software will allow the microcontroller to be programmed and con- nected to your application?
A package commonly called a "development system" is required. First, trained personnel must be available either on your technical staff or as consul- tants.
One person who is versed in digital hardware and computer software is the mini- mum number.
Many inexpensive EPROM programmers are sold that plug into a slot of most popular personal computers. More expensive, and more versatile, dedicated programmers are also available. An alternative to EPROMs are vendor- supplied prototype cards that allow code to be down loaded from a host computer. Finally, software is needed, along with a personal computer to host it. The minimum software package consists of a machine language assembler.
More expensive software mainly consisting of high-level language compilers and debuggers is also available. A minimum development system, then, consists of a personal computer, a plug-in EPROM programmer, and a public-brand assembler.
A more extensive system would con- sist of vendor-supplied dedicated computer systems with attendant high-level software packages and in-circuit emulators for hardware and software debugging. Summary The fundamental differences between microprocessors and microcontrollers are: Four-bit units are pro- duced in huge volumes for very simple applications, and 8-bit units are the most versatile.
Sixteen- and bit units are used in high-speed control and signal pro- cessing applications. Questions 1. Name four major differences hetween a microprocessor and a microcontroller.
Explain this difference.
Name 20 items that have a built-in microcontroller. Name 10 items that should have a built-in microcontroller. Namc the most unusual application of a microcontroller that you have seen actually for sale. Name thc most likely hit size for each of the following products. Explain why ROMless versions of microcontrollers exist 8. Name two ways to speed up digital data processing 9. List three esscntial items needed to make up a dcvelopment system for programming microcontrnllers.
Search the litcrature and letermine whether any manufacturer has announccd a W h i t micn controller. Introduction The first task faced when learning to use a new computer is to become familiar with the capability of the machine. The features of the computer are best learned by studying the internal hardware design, also called the architecture of the device, to determine the type, number, and size of thc registers and other circuitry. The hardware is manipulated by an accompanying set of program instructions, or software, which is usually studied next.
Once familiar with the hardware and software, the system designer can then apply the microcontroller to the problems at hand.
A natural question during this process is "What do I do with all this stuff? This chapter provides a broad overview of the architecture of the 1. In subsequent chapters, we will cover in greater detail the interaction between the hardware and the software.
The 8051 Microcontroller Kenneth J Ayala
A n enhanced version o f the , the , also exists with its own family o f variations and even includes one member that can be programmed i n BASIC.
This gal- axy o f parts, the result o f desires b y the manufacturers to leave no market niche unfilled, would require many chapters to cover. I n this chapter, we w i l l study a "generic" , housed i n a pin DIP, and direct the investigation o f a particular type to the data books.
The block diagram o f the i n Figure 2. The figure also shows the usual CPU components: Four register banks, each containing eight registers Sixteen bytes, which may be addressed at the bit level Eighty bytes of general-purpose data memory Thirty-two inputloutput pins arranged as four 8-bit ports: PO-P3 Two bit timerlcounters: TO and T1 Full duplex serial data receiverltransmitter: SBUF Control registers: These registers and memory locations can be made to operate using the software instructions that are incorporated as part of the design.
The program instructions have to do with the control of the registers and digital data paths that are physically contained inside the , as well as memory locations that are physically located outside the The model is complicated by the number of special-purpose registers that must be present to make a microcomputer a microcontroller. A cursory inspection of the model is recommended for the first-time viewer; return to the model as needed while progressing through the remainder of the text.
Most of the registers have a specific function; those that do occupy an individual block with a symbolic name, such as A or THO or PC. Others, which are generally indis- tinguishable from each other, are grouped in a larger block, such as internal ROM or RAM memory. Each register, with the exception of the program counter, has an internal 1-byte ad- dress assigned to it.
That is, the entire byte of data at such register addresses may be read or altered, or individual bits may be read or altered. Software instructions are gener- ally able to specify a register by its address, its symbolic name, or both. A pinout of the packaged in a pin DIP is shown in Figure 2. It is important to note that many of the. For this reason. Alternate functions are shown b e l o w the p o r t name in parentheses.
Pin n u m - bers and pin names are shown inside the DIP package. Not all of the possible features may be used at the same time. For example, port 3 bit 0 abbreviated P3. The system designer decides which of these two functions is to be used and designs the hard- ware and software affecting that pin accordingly.
The Oscillator and Clock The heart of the is the circuitry that generates the clock pulses by which all internal operations are synchronized. Typically, a quartz crystal and capacitors are em- ployed, as shown in Figure 2. The crystal frequency is the basic internal clock fre- quency of the microcontroller. The manufacturers make available designs that can run at specified maximum and minimum frequencies, typically 1 megahertz to 16 mega- hertz.
Minimum frequencies imply that some internal memories are dynamic and must always operate above a minimum frequency, or data will be lost. Communication needs often dictate the frequency of the oscillator due to the require- ment that internal counters must divide the basic clock rate to yield standard communica- tion bit per second baud rates. If the basic clock frequency is not divisible without a remainder. Ceramic resonators may be used as a low-cost alternative to crystal resonators.
How- ever, decreases in frequency stability and accuracy make the ceramic resonator a poor choice if high-speed serial data communication with other systems, or critical timing, is to be done. The oscillator formed by the crystal, capacitors, and an on-chip inverter generates a pulse train at the frequency of the crystal, as shown in Figure 2.
The clock frequency, f. The smallest interval of time to accomplish any simple instruction, or part of a complex instruction, however, is the machine cycle. The machine cycle is itself made up of six states.
A state is the basic time interval for discrete operations of the microcontroller such as fetching an opcode byte, decoding an opcode, executing an opcode, or writing a data byte.
Two oscillator pulses define each state. Program instructions may require one, two, or four machine cycles to be executed, depending on the type of instruction. Instructions are fetched and executed by the micro- controller automatically, beginning with the instruction located at ROM memory address OOOOh at the time the microcontroller is first reset.
To calculate the time any particular instruction will take to be executed, find the num- ber of cycles, C, from the list in Appendix A. The time to execute that instruction is then found by multiplying C by 12 and dividing the product by the crystal frequency: A 12 megahertz crystal yields the con- venient time of one microsecond per cycle.
An Program Counter and Data Pointer The contains two bit registers: Each is used to hold the address of a byte in memory. Program instruction bytes are fetched from locations in memory that are addressed by the PC. The PC is automatically incremented after every instruction byte is fetched and may also be altered by certain instructions.
The PC is the only register that does not have an internal address. Two of these, registers A and B, comprise the mathematical core of the central processing unit CPU. The A accumulator register is the most versatile of the two CPU registers and is used for many operations, including addition, subtraction, integer multiplication and divi- sion, and Boolean bit manipulations. The A register is also used for all data transfers be- tween the and any external memory.
The B register is used with the A register for multiplication and division operations and has no other function other than as a location where data may be stored. Other instructions can test the condition of the flags and make decisions based upon the Rag states. In order that the flags may be conveniently addressed, they are grouped inside the program status word PSW and the power control PCON registers.
The has four math flags that respond automatically to the outcomes of math operations and three general-purpose user flags that can be set to I or cleared to 0 by the programmer as desired.
Note that all of the flags can he set and cleared by the programmer at will. The math flags, however. The program status word is shown in Figure 2. The PSW contains the math Rags, user program flag FO, and the register select bits that identify which of the four general- purpose register banks is currently in use by the program. Detailed descriptions of the math flag operations will be discussed in chapters that cover the opcodes that affect the flags.
The user flags can be set or cleared using data move instructions covered in Chapter 3. Additional memory can be added externally using suitable circuits. Unlike microcontrollers with Von Neumann architectures, which can use a single memory address for either program code or data, but not,for both, the 1 has a Harvard architecture, which uses the same address, in different memories, for code and data.
In- ternal circuitry accesses the correct memory based upon the nature of the operation in progress. Thirty-two bytes from address OOh to IFh that make up 32 working registers or- ganized as four banks of eight registers each. The four register banks are num- bered O to 3 and are made up of eight registers named RO to R7. Each register can be addressed by name when its bank is selected or by its RAM address.
Thus RO of bank 3 is RO if bank 3 is currently selected or address 18h whether bank 3 is selected or not. Register banks not selected can be used as general-purpose RAM. Bank 0 is selected upon reset. A bit-addressable area of 16 bytes occupies RAM byte addresses 20h to 2Fh, forming a total of addressable bits. An addressable bit may be specified by its bit address of OOh to 7Fh, or 8 bits may form any byte address from 20h to 2Fh.
Thus, for example, bit address 4Fh is also bit 7 of byte address 29h. Ad- dressable bits are useful when the program need only remember a binary event switch on, light off, etc. Internal RAM is in short supply as it is, so why use a byte when a bit will do? A general-purpose RAM area above the bit area, from 30h to 7Fh, addressable as bytes. The Stack and the Stack Pointer The stack refers to an area of internal RAM that is used in conjunction with certain op- codes to store and retrieve data quickly.
The 8-bit stack pointer SP register is used by the to hold an internal RAM address that is called the "top of the stack. When data is to be placed on the stack, the SP increments before storing data on the stack so that the stack grows up as data is stored. As data is retrieved from the stack, the byte is read from the stack, and then the S P decrements to point to the next available byte of stored data. Operation of the stack and the SP is shown in Figure 2. The SP is set to 07h when the is reset and can be changed to any internal RAM address by the programmer.
The stack is limited in height to the size of the internal RAM. The stack has the poten- tial if the programmer is not careful to limit its growth to overwrite valuable data in the register banks, bit-addressable RAM, and scratch-pad RAM areas. The programmer is responsible for making sure the stack does not grow beyond pre-defined bounds!
The stack is normally placed high in internal RAM, by an appropriate choice of the number placed in the SP register. StoringData on the Stack m Address This feature allows the programmer to change only what needs to be altered, leaving the remaining bits in that SFR unchanged. Not all o f the addresses from 80h to FFh are used for SFRs, and attempting to use an address that is not defined, or "empty," results in unpredictable results.
I n Figure 2. Failure to use this number convention will result in an assembler error when the program is assembled. Internal ROM The is organized so that data memory and program code memory can be in two entirely different physical memory entities. Each has the same address ranges. The structure of the internal RAM has been discussed previously.
Program addresses higher than OFFFh, which exceed the inter- nal ROM capacity, will cause the to automatically fetch code bytes from external program memory.
As noted in Chapter I , microprocessor designs must add additional chips to interface with external circuitry; this ability is built into the microcontroller. To be commercially viable, the had to incorporate as many functions as were technically and economically feasible.
The main constraint that limits numerous functions is the number of pins available to the circuit designers. The DIP has 40 pins, and the success of the design in the marketplace was determined by the flexibility built into the use of these pins.
For this reason, 24 of the pins may each be used for one of two entirely different functions, yielding a total pin configuration of The function a pin performs at any given instant depends, first, upon what is physically connected to it and, then, upon what software commands are used to "program" the pin.
Both of these factors are under the complete control of the programmer and circuit designer. Given this pin flexibility, the may be applied simply as a single component with only, or it may be expanded to include additional memory, parallel ports, and serial data communication by using the alternate pin assignments.
The key to programming an alternate pin function is the port pin circuitry shown in Figure 2. Each port has a D-type output latch for each pin. For in- stance, the eight latches for port 0 are addressed at location 80h; port 0 pin 3 is bit 2 of the PO SFR.
The port latches should not be confused with the port pins; the data on the latches does not have to be the same as that on the pins. The two data paths are shown in Figure 2. The top buffer is enabled when latch data is read, and the lower buffer, when the pin state is read. The status of each latch may be read from a latch buffer, while an input buffer is connected directly to each pin so that the pin status may be read independently of the latch state.
Different opcodes access the latch or pin states as appropriate. Port operations are determined by the manner in which the is connected to external circuitry. Programmable port pins have completely different alternate functions. The configura- tion of the control circuitry between the output latch and the port pin determines the nature of any particular port pin function. An inspection of Figure 2. The ports are not capable of driving loads that require currents in the tens of milli- amperes mA.
As previously mentioned. An example range of logic-level currents, volt- ages, and total device power requirements is given in the following table:. CMOS 2. OV 10pA mW.
These figures tell us that driving more than two LSTTL inputs degrades the noise immunity of the ports and that careful attention must be paid to buffering the ports when they must drive currents in excess of those listed. Again, one must refer to the manufac- turers' data books when designing a "real" application. Port 0 Port 0 pins may serve as inputs. For example, when a pin is to be used as an input, a I must be written to the corresponding port 0 latch by the program, thus turn- ing both of the output transistors off, which in turn causes the pin to "float" in a high- impedance state, and the pin is essentially connected to the input buffer.
When used as an output, the pin latches that are programmed to a 0 will turn on the lower FET, grounding the pin.
E&E Final 11-12 30page (2).pdf - BMS College of Engineering
All latches that are programmed to a 1 still float; thus, external pullup resistors will be needed to supply a logic high when using port 0 as an output. When port 0 is used as an address bus to external memory, internal control signals switch the address lines to the gates of the Field Effect Transistories FETs. After the address has been formed and latched into external circuits by the Address Latch Enable ALE pulse, the bus is turned around to become a data bus.
Port 0 now reads data from the external memory and must be configured as an input, so a logic 1 is automatically written by internal control logic to all port 0 latches. Port 1 Port I pins have no dual functions. Used as an input, a I is written to the latch, turning the lower FET off; the pin and the input to the pin buffer are pulled high by the FET load. An external circuit can overcome the high impedance pullup and drive the pin low to input a 0 or leave the input high for a 1.
If used as an output, the latches containing a I can drive the input of an external circuit high through the pullup. If a 0 is written to the latch, the lower FET is on, the pullup is off, and the pin can drive the input of the external circuit low.
To aid in speeding up switching times when the pin is used as an output, the internal FET pullup has another FET in parallel with it. The second FET is turned on for two oscillator time periods during a low-to-high transition on the pin, as shown in Figure 2. This arrangement provides a low impedance path to the positive voltage supply to help reduce rise times in charging any parasitic capacitances in the external circuitry. Port 2 Port 2 may be used as an inputloutput port similar in operation to port 1.
The alternate use of port 2 is to supply a high-order address byte in conjunction with the port 0 low-order byte to address external memory. Port 2 pins are momentarily changed by the address control signals when supplying the high byte of a bit address. Port 2 latches remain stable when external memory is addressed, as they do not have to be turned around set to 1 for data input as is the case for port 0.
Port 3 Port 3 is an inputloutput port similar to port I. The input and output functions can be programmed under the control of the P3 latches or under the control of various other spe- cial function registers.
The port 3 alternate uses are shown in the following table: Unlike ports 0 and 2, which can have external addressing functions and change all eight port bits when in alternate use, each pin of port 3 may be individually programmed to be used either as or as one of the alternate functions. Internal control circuitry accesses the correct physical memory, depending upon the machine cycle state and the opcode being executed. There are several reasons for adding external memory, particularly program memory, when applying the in a system.
When the project is in the prototype stage, the expense-in time and money-of having a masked internal ROM made for each program "try" is prohibitive. To alleviate this problem. The resulting circuit board layout will be identical to one that uses a factory-programmed 1.
The only drawbacks to the are the specialized EPROM programmers that must be used to program the non-standard pin part, and the limit of "only" bytes of program code.
The solution works well if the program will fit into 4K bytes. Unfortunately, many times, particularly if the program is written in a high-level language, the program size exceeds 4K hytes, and an external program memory is needed. Again, the manufac- turers provide a version for the job, the ROMless External RAM. External RAM, up to 64K bytes, may also be added to any chip in the family. Connecting External Memory Figure 2. The accesses exter- nal RAM whenever certain program instructions are executed.
Figure 2. Dur- ing any memory access cycle, port 0 is time multiplexed. That is, it first provides the lower byte of the bit memory address, then acts as a bidirectional data bus to write or read a byte of memory data. Port 2 provides the high byte of the memory address during the entire memory readlwrite cycle.
The lower address byte from port 0 must be latched into an external register to save the byte. Address byte save is accomplished by the ALE clock pulse that provides the correct timing for the ' type data latch. The port 0 pins then become free to serve as a data bus.
Port 2 A15 I I. Enable Read Write Pulse. Set when timer rolls from all ones to zero. Cleared when processor vectors to execute Interrupt service routlne located at program address Bh. Set to 1 by program to enable timer to count; cleared to 0 by program to halt timer. Does not reset timer. Cleared when processor vectors to execute interrupt service routine located at program address Bh. Set to 1 by program to enable tlmer to count; cleared to 0 by program to halt timer. Set to 1 when a high to low edge stgnal IS received on port 3 pin 3.
Not related to timer operations. Set to 1 by program to enable external interrupt 1 to be trtggered by a falling edge signal. Set to 0 by program to enable a low level signal on external interrupt t to generate an interrupt. Set to 1 when a high to low edge signal is received on port 3 pln 3. Cleared when processor vectors to interrupt service routine located at program address h. Not related to timer operations Continued.
Note that theWR and RD signals are alternate uses for port 3 pins 16 and Java Programming Fundamentals: For Beginners in Hindi 75 videos. C Programming for Beginners: From Zero to Hero! Related content.
Continue with Google or Continue with Facebook. Why do I need to sign in?Microcontrollers are not as well known to the general public, or even the technical community, as are the more glamorous microprocessors. Anne, my wife, for many years of patience and understanding. Each high and low state of the input pulse must thus be held constant for at least one machine cycle to ensure reliable counting.
Further information on products developed by PseudoCorp follows this Preface. The solution to this problem is identical to that for unsigned numbers, except a DA A must be added after each ADD instruction.