Thursday, March 26, 2020

Gps gsm based Tracking free essay sample

ABSTRACT In this Project it is proposed to design an embedded system which is used for tracking and positioning of any vehicle by using Global Positioning Syste (GPS) and Global system for mobile communication (GSM). In this project P89V51RD2 microcontroller is used for interfacing to various hardware peripherals. The current design is an embedded application, which will continuously monitor a moving Vehicle and report the status of the Vehicle on demand. For doing so an P89V51RD2 microcontroller is interfaced serially to a GSM Modem and GPS Receiver. A GSM modem is used to send the position (Latitude and Longitude) of the vehicle from a remote place. The GPS modem will continuously give the data i. e. the latitude and longitude indicating the position of the vehicle. The GPS modem gives many parameters as the output, but only the NMEA data coming out is read and displayed on to the LCD. We will write a custom essay sample on Gps gsm based Tracking or any similar topic specifically for you Do Not WasteYour Time HIRE WRITER Only 13.90 / page The same data is sent to the mobile at the other end from where the position of the vehicle is demanded. An EEPROM is used to store the mobile number. The hardware interfaces to microcontroller are LCD display, GSM modem and GPS Receiver. The design uses RS-232 protocol for serial communication between the modems and the microcontroller. A serial driver IC is used for converting TTL voltage levels to RS-232 voltage levels. When the request by user is sent to the number at the modem, the system automatically sends a return reply to that mobile indicating the position of the vehicle in terms of latitude and longitude. SOFTWARE: Embedded ‘C’ TOOLS: Keil uvision, uC flash programmer. TARGET DEVICE: P89V51RD2(8051 Microcontroller) APPLICATIONS: Vehicle tracking. ADVANTAGES: Low cost, automated operation, Low Power consumption. REFERENCE: The 8051 micro controller and embedded systems by Mazidi Index 1. Introduction to Embedded Systems 2. 8051 , Block diagram , Pin description 3. P89V51RD2 Microcontrollers 4. GPS, 5. GSM 6. LCD 7. Working flow of the project Block diagram and Schematic diagram 8. Source code 9. Keil software 10. Conclusion 11. Bibliography Chapter 1 Introduction to Embedded Systems EMBEDDED SYSTEM An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions, sometimes with real-time computing constraints. It is usually embedded as part of a complete device including hardware and mechanical parts. In contrast, a general-purpose computer, such as a personal computer, can do many different tasks depending on programming. Embedded systems have become very important today as they control many of the common devices we use. Since the embedded system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product, or increasing the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale. Physically, embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure. In general, embedded system is not an exactly defined term, as many systems have some element of programmability. For example, Handheld computers share some elements with embedded systems — such as the operating systems and microprocessors which power them — but are not truly embedded systems, because they allow different applications to be loaded and peripherals to be connected. An embedded system is some combination of computer hardware and software, either fixed in capability or programmable, that is specifically designed for a particular kind of application device. Industrial machines, automobiles, medical equipment, cameras, household appliances, airplanes, vending machines, and toys (as well as the more obvious cellular phone and PDA) are among the myriad possible hosts of an embedded system. Embedded systems that are programmable are provided with a programming interface, and embedded systems programming is a specialized occupation. Certain operating systems or language platforms are tailored for the embedded market, such as Embedded Java and Windows XP Embedded. However, some low-end consumer products use very inexpensive microprocessors and limited storage, with the application and operating system both part of a single program. The program is written permanently into the systems memory in this case, rather than being loaded into RAM (random access memory), as programs on a personal computer are. APPLICATIONS OF EMBEDDED SYSTEM We are living in the Embedded World. You are surrounded with many embedded products and your daily life largely depends on the proper functioning of these gadgets. Television, Radio, CD player of your living room, Washing Machine or Microwave Oven in your kitchen, Card readers, Access Controllers, Palm devices of your work space enable you to do many of your tasks very effectively. Apart from all these, many controllers embedded in your car take care of car operations between the bumpers and most of the times you tend to ignore all these controllers. In recent days, you are showered with variety of information about these embedded controllers in many places. All kinds of magazines and journals regularly dish out details about latest technologies, new devices; fast applications which make you believe that your basic survival is controlled by these embedded products. Now you can agree to the fact that these embedded products have successfully invaded into our world. You must be wondering about these embedded controllers or systems. What is this Embedded System? The computer you use to compose your mails, or create a document or analyze the database is known as the standard desktop computer. These desktop computers are manufactured to serve many purposes and applications. You need to install the relevant software to get the required processing facility. So, these desktop computers can do many things. In contrast, embedded controllers carryout a specific work for which they are designed. Most of the time, engineers design these embedded controllers with a specific goal in mind. So these controllers cannot be used in any other place. Theoretically, an embedded controller is a combination of a piece of microprocessor based hardware and the suitable software to undertake a specific task. These days designers have many choices in microprocessors/microcontrollers. Especially, in 8 bit and 32 bit, the available variety really may overwhelm even an experienced designer. Selecting a right microprocessor may turn out as a most difficult first step and it is getting complicated as new devices continue to pop-up very often. In the 8 bit segment, the most popular and used architecture is Intels 8031. Market acceptance of this particular family has driven many semiconductor manufacturers to develop something new based on this particular architecture. Even after 25 years of existence, semiconductor manufacturers still come out with some kind of device using this 8031 core. MICROCONTROLLER VERSUS MICROPROCESSOR What is the difference between a Microprocessor and Microcontroller? By microprocessor is meant the general purpose Microprocessors such as Intels X86 family (8086, 80286, 80386, 80486, and the Pentium) or Motorolas 680X0 family (68000, 68010, 68020, 68030, 68040, etc). These microprocessors contain no RAM, no ROM, and no I/O ports on the chip itself. For this reason, they are commonly referred to as general-purpose Microprocessors. A system designer using a general-purpose microprocessor such as the Pentium or the 68040 must add RAM, ROM, I/O ports, and timers externally to make them functional. Although the addition of external RAM, ROM, and I/O ports makes these systems bulkier and much more expensive, they have the advantage of versatility such that the designer can decide on the amount of RAM, ROM and I/O ports needed to fit the task at hand. This is not the case with Microcontrollers. A Microcontroller has a CPU (a microprocessor) in addition to a fixed amount of RAM, ROM, I/O ports, and a timer all on a single chip. In other words, the processor, the RAM, ROM, I/O ports and the timer are all embedded together on one chip; therefore, the designer cannot add any external memory, I/O ports, or timer to it. The fixed amount of on-chip ROM, RAM, and number of I/O ports in Microcontrollers makes them ideal for many applications in which cost and space are critical. In many applications, for example a TV remote control, there is no need for the computing power of a 486 or even an 8086 microprocessor. These applications most often require some I/O operations to read signals and turn on and off certain bits. MICROCONTROLLERS FOR EMBEDDED SYSTEMS In the Literature discussing microprocessors, we often see the term Embedded System. Microprocessors and Microcontrollers are widely used in embedded system products. An embedded system product uses a microprocessor (or Microcontroller) to do one task only. A printer is an example of embedded system since the processor inside it performs one task only; namely getting the data and printing it. Contrast this with a Pentium based PC. A PC can be used for any number of applications such as word processor, print-server, bank teller terminal, Video game, network server, or Internet terminal. Software for a variety of applications can be loaded and run. Of course the reason a pc can perform myriad tasks is that it has RAM memory and an operating system that loads the application software into RAM memory and lets the CPU run it. In an Embedded system, there is only one application software that is typically burned into ROM. An x86 PC contains or is connected to various embedded products such as keyboard, printer, modem, disk controller, sound card, CD-ROM drives, mouse, and so on. Each one of these peripherals has a Microcontroller inside it that performs only one task. For example, inside every mouse there is a Microcontroller to perform the task of finding the mouse position and sending it to the PC. Table 1-1 lists some embedded products. Chapter. 2 8051,Block diagram, Pin description 8051 ARCHITECTURE The generic 8051 architecture supports a Harvard architecture, which contains two separate buses for both program and data. So, it has two distinctive memory spaces of 64K X 8 size for both programmed and data. It is based on an 8 bit central processing unit with an 8 bit Accumulator and another 8 bit B register as main processing blocks. Other portions of the architecture include few 8 bit and 16 bit registers and 8 bit memory locations. Each 8051 device has some amount of data RAM built in the device for internal processing. This area is used for stack operations and temporary storage of data. This bus architecture is supported with on-chip peripheral functions like I/O ports, timers/counters, versatile serial communication port. So it is clear that this 8051 architecture was designed to cater many real time embedded needs. FEATURES OF 8051 ARCHITECTURE Optimized 8 bit CPU for control applications and extensive Boolean processing capabilities. 64K Program Memory address space. 64K Data Memory address space. 128 bytes of on chip Data Memory. 32 Bi-directional and individually addressable I/O lines. Two 16 bit timer/counters. Full Duplex UART. 6-source / 5-vector interrupt structure with priority levels. On chip clock oscillator. Now we may be wondering about the non-mentioning of memory space meant for the program storage, the most important part of any embedded controller. Originally this 8051 architecture was introduced with on-chip, ‘one time programmable’ version of Program Memory of size 4K X 8. Intel delivered all these microcontrollers (8051) with user’s program fused inside the device. The memory portion was mapped at the lower end of the Program Memory area. But, after getting devices, customers couldn’t change any thing in their program code, which was already made available inside during device fabrication. BLOCK DIAGRAM OF 8051 Figure 4. 1 Block Diagram of the 8051 Core So, very soon Intel introduced the 8051 devices with re-programmable type of Program Memory using built-in EPROM of size 4K X 8. Like a regular EPROM, this memory can be re-programmed many times. Later on Intel started manufacturing these 8031 devices without any on chip Program Memory. MICROCONTROLLER LOGIC SYMBOL ALE/PROG: Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. ALE is emitted at a constant rate of 1/6 of the oscillator frequency, for external timing or clocking purposes, even when there are no accesses to external memory. (However, one ALE pulse is skipped during each access to external Data Memory. ) This pin is also the program pulse input (PROG) during EPROM programming. PSEN : Program Store Enable is the read strobe to external Program Memory. When the device is executing out of external Program Memory, PSEN is activated twice each machine cycle (except that two PSEN activations are skipped during accesses to external Data Memory). PSEN is not activated when the device is executing out of internal Program Memory. EA/VPP: When EA is held high the CPU executes out of internal Program Memory (unless the Program Counter exceeds 0FFFH in the 80C51). Holding EA low forces the CPU to execute out of external memory regardless of the Program Counter value. In the 80C31, EA must be externally wired low. In the EPROM devices, this pin also receives the programming supply voltage (VPP) during EPROM programming. XTAL1: Input to the inverting oscillator amplifier. XTAL2: Output from the inverting oscillator amplifier. The 8051’s I/O port structure is extremely versatile and flexible. The device has 32 I/O pins configured as four eight bit parallel ports (P0, P1, P2 and P3). Each pin can be used as an input or as an output under the software control. These I/O pins can be accessed directly by memory instructions during program execution to get required flexibility. These port lines can be operated in different modes and all the pins can be made to do many different tasks apart from their regular I/O function executions. Instructions, which access external memory, use port P0 as a multiplexed address/data bus. At the beginning of an external memory cycle, low order 8 bits of the address bus are output on P0. The same pins transfer data byte at the later stage of the instruction execution. Also, any instruction that accesses external Program Memory will output the higher order byte on P2 during read cycle. Remaining ports, P1 and P3 are available for standard I/O functions. But all the 8 lines of P3 support special functions: Two external interrupt lines, two counter inputs, serial port’s two data lines and two timing control strobe lines are designed to use P3 port lines. When you don’t use these special functions, you can use corresponding port lines as a standard I/O. Even within a single port, I/O operations may be combined in many ways. Different pins can be configured as input or outputs independent of each other or the same pin can be used as an input or as output at different times. You can comfortably combine I/O operations and special operations for Port 3 lines. All the Port 3 pins are multifunctional. They are not only port pins, but also serve the functions of various special features as listed below: Port Pin Alternate Function P3. 0 RxD (serial input port) P3. 1 TxD (serial output port) as a term has come to be known is a general-purpose digital computer central processing unit. Although popularly known as a computer on a chip. The microprocessor contains arithmetic and logic unit, program counter, Stack pointer, some working registers, clock TIMERS/COUNTERS 8051 has two 16 bit Timers/Counters capable of working in different modes. Each consists of a ‘High’ byte and a ‘Low’ byte which can be accessed under software. There is a mode control register and a control register to configure these timers/counters in number of ways. These timers can be used to measure time intervals, determine pulse widths or initiate events with one microsecond resolution up to a maximum of 65 millisecond (corresponding to 65, 536 counts). Use software to get longer delays. Working as counter, they can accumulate occurrences of external events (from DC to 500 KHz) with 16 bit precision. SERIAL PORTS Each 8051 microcomputer contains a high speed full duplex (means you can simultaneously use the same port for both transmitting and receiving purposes) serial port which is software configurable in 4 basic modes: 8 bit UART; 9 bit UART; inter processor Communications link or as shift register I/O expander. For the standard serial communication facility, 8051 can be programmed for UART operations and can be connected with regular personal computers, teletype writers, modem at data rates between 122 bauds and 31 kilo bauds. Getting this facility is made very simple using simple routines with option to elect even or odd parity. You can also establish a kind of Inter processor communication facility among many microcomputers in a distributed environment with automatic recognition of address/data. Apart from all above, you can also get super fast I/O lines using low cost simple TTL or CMOS shift registers. MICROPROCESSOR A microprocessor timing circuit and interrupt circuits. To make a complete computer one must add memory usually RAM ROM, memory decoders, an oscillator and number of I/O devices such as parallel and serial data ports in addition special purpose devices such as interrupt handlers and counters. The key term in describing the design of the microprocessor is â€Å"general purpose†. The hardware design of a microprocessor CPU is arranged so that a small or very large system can be configured around the CPU as the application demands. The prime use of microprocessor is to read data, perform extensive calculations on that data and store those calculations in a mass storage device. The programs used by the microprocessor are stored in the mass storage device and loaded in the RAM as the user directs. A few microprocessor programs are stored in the ROM. The ROM based programs are primarily are small fixed programs that operate on peripherals and other fixed device that are connected to the system BLOCK DIAGRAM OF MICROPROCESSOR MICROCONTROLLER Micro controller is a true computer on a chip the design incorporates all of the features found in a microprocessor CPU: arithmetic and logic unit, stack pointer, program counter and registers. It has also had added additional features like RAM, ROM, serial I/O, counters and clock circuit. Like the microprocessor, a microcontroller is a general purpose device, but one that is meant to read data, perform limited calculations on that data and control it’s environment based on those calculations. The prime use of a microcontroller is to control the operation of a machine using a fixed program that is stored in ROM and that does not change over the lifetime of the system. The design approach of a microcontroller uses a more limited set of single byte and double byte instructions that are used to move code and data from internal memory to ALU. Many instructions are coupled with pins on the IC package; the pins are capable of having several different functions depending on the wishes of the programmer. The microcontroller is concerned with getting the data from and on to its own pins; the architecture and instruction set are optimized to handle data in bit and byte size. FUNCTIONAL BLOCKS OF A MICROCONTROLLER CRITERIA FOR CHOOSING A MICROCONTROLLER 1. The first and foremost criterion for choosing a microcontroller is that it must meet task at hands efficiently and cost effectively. In analyzing the needs of a microcontroller based project we must first see whether it is an 8-bit, 16-bit or 32-bit microcontroller and how best it can handle the computing needs of the task most effectively. The other considerations in this category are: (a) Speed: The highest speed that the microcontroller supports (b) Packaging: Is it 40-pin DIP or QPF or some other packaging format? This is important in terms of space, assembling and prototyping the End product. (c) Power Consumption: This is especially critical for battery-powered Products. (d) The amount of RAM and ROM on chip (e) The number of I/O pins and timers on the chip. (f) Cost per unit: This is important in terms of final product in which a microcontroller is used. 2. The second criteria in choosing a microcontroller are how easy it is to develop products around it. Key considerations include the availability of an assembler, debugger, a code efficient ‘C’ language compiler, emulator, technical support and both in house and outside expertise. In many cases third party vendor support for chip is required. 3. The third criteria in choosing a microcontroller is it readily available in needed quantities both now and in future. For some designers this is even more important than first two criteria’s. Currently, of leading 8–bit microcontrollers, the 89C51 family has the largest number of diversified (multiple source) suppliers. By suppliers meant a producer besides the originator of microcontroller in the case of the 89C51, which was originated by Intel, several companies are also currently producing the 89C51. Viz: INTEL, PHILIPS, These companies include PHILIPS, SIEMENS, and DALLAS-SEMICONDUCTOR. It should be noted that Motorola, Zilog and Microchip Technologies have all dedicated massive resource as to ensure wide and timely availability of their product since their product is stable, mature and single sourced. In recent years they also have begun to sell the ASIC library cell of the microcontroller. Chapter. 3 P89V51RD2 Microcontrollers P89V51RD2 Features †¢ Compatible with MCS ®-51 Products †¢ 8K Bytes of In-System Programmable (ISP) Flash Memory – Endurance: 10,000 Write/Erase Cycles †¢ 4. 0V to 5. 5V Operating Range †¢ Fully Static Operation: 0 Hz to 33 MHz †¢ Three-level Program Memory Lock †¢ 256 x 8-bit Internal RAM †¢ 32 Programmable I/O Lines †¢ Three 16-bit Timer/Counters †¢ Eight Interrupt Sources †¢ Full Duplex UART Serial Channel †¢ Low-power Idle and Power-down Modes †¢ Interrupt Recovery from Power-down Mode †¢ Watchdog Timer †¢ Dual Data Pointer †¢ Power-off Flag †¢ Fast Programming Time †¢ Flexible ISP Programming (Byte and Page Mode) †¢ Green (Pb/Halide-free) Packaging Option Description The P89V51RD2 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the indus-try-standard 80C51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory pro-grammer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel P89V51RD2 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. The P89V51RD2 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the P89V51RD2 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM con-tents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset. Block Diagram Pin Configurations Pin Description VCC Supply voltage. GND Ground. Port 0 Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes dur-ing program verification. External pull-ups are required during program verification. Port 1 Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the inter-nal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. In addition, P1. 0 and P1. 1 can be configured to be the timer/counter 2 external count input (P1. 0/T2) and the timer/counter 2 trigger input (P1. 1/T2EX), respectively, as shown in the follow-ing table. Port 1 also receives the low-order address bytes during Flash programming and verification. Port 2 Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the inter-nal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and dur-ing accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash program-ming and verification. Port Pin Alternate Functions P1. 0 T2 (external count input to Timer/Counter 2), clock-out P1. 1 T2EX (Timer/Counter 2 capture/reload trigger and direction control) P1. 5 MOSI (used for In-System Programming) P1. 6 MISO (used for In-System Programming) P1. 7 SCK (used for In-System Programming)5 1919D–MICRO–6/ Port 3 Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the inter-nal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the P89V51RD2, as shown in the fol-lowing table. RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives high for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled. ALE/PROG Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped dur-ing each access to external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode PSEN Program Store Enable (PSEN) is the read strobe to external program memory. When the P89V51RD2 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to exter-nal data memory. EA/VPP External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting oscillator amplifier. Special Function Registers A map of the on-chip memory area called the Special Function Register (SFR) space is shown in Table 5-1. Note that not all of the addresses are occupied, and unoccupied addresses may not be imple-mented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect. User software should not write 1s to these unlisted locations, since they may be used in future products to invoke new features. In that case, the reset or inactive values of the new bits will always be 0. Timer 2 Registers: Control and status bits are contained in registers T2CON (shown in Table 5- 2) and T2MOD (shown in Table 10-2) for Timer 2. The register pair (RCAP2H, RCAP2L) are the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode. Interrupt Registers: The individual interrupt enable bits are in the IE register. Two priorities can be set for each of the six interrupt sources in the IP register. Memory Organization MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes each of external Program and Data Memory can be addressed. Program Memory If the EA pin is connected to GND, all program fetches are directed to external memory. On the P89V51RD2, if EA is connected to VCC, program fetches to addresses 0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to external memory. Data Memory The P89V51RD2 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function Registers. This means that the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space. When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions which use direct addressing access the SFR space. For example, the following direct addressing instruction accesses the SFR at location 0A0H (which is P2). MOV 0A0H, #data Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the following indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H). MOV @R0, #data Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are available as stack space. Watchdog Timer (One-time Enabled with Reset-out) The WDT is intended as a recovery method in situations where the CPU may be subjected to software upsets. The WDT consists of a 14-bit counter and the Watchdog Timer Reset (WDTRST) SFR. The WDT is defaulted to disable from exiting reset. To enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H). When the WDT is enabled, it will increment every machine cycle while the oscillator is running. The WDT timeout period is dependent on the external clock frequency. There is no way to disable the WDT except through reset (either hardware reset or WDT overflow reset). When WDT over-flows, it will drive an output RESET HIGH pulse at the RST pin. Using the WDT To enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H). When the WDT is enabled, the user needs to service it by writing 01EH and 0E1H to WDTRST to avoid a WDT overflow. The 14-bit counter ove

Friday, March 6, 2020

Venezuela’s Declaration of Independence in 1810

Venezuela’s Declaration of Independence in 1810 The republic of Venezuela celebrates its independence from Spain on two different dates: April 19, when an initial declaration of semi-independence from Spain was signed in 1810, and July 5, when a more definitive break was signed in 1811. April 19 is known as â€Å"Firma Acta de la Independencia† or â€Å"Signing of the Act of Independence.† Napoleon Invades Spain The first years of the nineteenth century were turbulent ones in Europe, particularly in Spain. In 1808, Napoleon Bonaparte invaded Spain and put his brother Joseph on the throne, throwing Spain and its colonies into chaos. Many Spanish colonies, still loyal to the deposed King Ferdinand, did not know how to react to the new ruler. Some cities and regions opted for a limited independence: they would take care of their own affairs until such time as Ferdinand was restored. Venezuela: Ready for Independence Venezuela was ripe for Independence long before other South American regions. Venezuelan Patriot Francisco de Miranda, a former general in the French Revolution, led a failed attempt to start a revolution in Venezuela in 1806, but many approved of his actions. Young firebrand leaders like Simà ³n Bolà ­var and Josà © Fà ©lix Ribas were actively speaking of making a clean break from Spain. The example of the American Revolution was fresh in the minds of these young patriots, who wanted freedom and their own republic. Napoleonic Spain and the Colonies In January of 1809, a representative of the Joseph Bonaparte government arrived in Caracas and demanded that taxes continue to be paid and that the colony recognize Joseph as their monarch. Caracas, predictably, exploded: people took to the streets declaring loyalty to Ferdinand. A ruling junta was proclaimed and Juan de Las Casas, the Captain-General of Venezuela, was deposed. When news reached Caracas that a loyalist Spanish government had been set up in Seville in defiance of Napoleon, things cooled down for a while and Las Casas was able to re-establish control. April 19, 1810 On April 17, 1810, however, news reached Caracas that the government loyal to Ferdinand had been crushed by Napoleon. The city erupted into chaos once more. Patriots who favored full independence and royalists loyal to Ferdinand could agree on one thing: they would not tolerate French rule. On April 19, Creole patriots confronted the new Captain-General Vicente Emparn and demanded self-rule. Emparn was stripped of authority and sent back to Spain. Josà © Fà ©lix Ribas, a wealthy young patriot, rode through Caracas, exhorting Creole leaders to come to the meeting taking place in the council chambers. Provisional Independence The elite of Caracas agreed on a provisional independence from Spain: they were rebelling against Joseph Bonaparte, not the Spanish crown, and would mind their own affairs until Ferdinand VII was restored. Still, they made some quick decisions: they outlawed slavery, exempted Indians from paying tribute, reduced or removed trade barriers, and decided to send envoys to the United States and Britain. Wealthy young nobleman Simà ³n Bolà ­var financed the mission to London. Legacy of the April 19 Movement The result of the Act of Independence was immediate. All over Venezuela, cities and towns decided either to follow Caracas lead or not: many cities chose to remain under Spanish rule. This led to fighting and a de facto Civil War in Venezuela. A Congress was called in early 1811 to solve the bitter fighting among Venezuelans. Although it was nominally loyal to Ferdinand - the official name of the ruling junta was Junta of conservation of the rights of Ferdinand VII - the government of Caracas was, in fact, quite independent. It refused to recognize the Spanish shadow government that was loyal to Ferdinand, and many Spanish officers, bureaucrats, and judges were sent back to Spain along with Emparn. Meanwhile, exiled patriot leader Francisco de Miranda returned, and young radicals such as Simà ³n Bolà ­var, who favored unconditional independence, gained influence. On July 5, 1811, the ruling junta voted in favor of complete Independence from Spain - their self-rule was no longer dependent on the state of the Spanish king. Thus was born the ​First Venezuelan Republic, doomed to die in 1812 after a disastrous earthquake and relentless military pressure from royalist forces. The April 19 pronouncement was not the first of its kind in Latin America: the city of Quito had made a similar pronouncement in August of 1809. Still, the independence of Caracas had much longer lasting effects than that of Quito, which was quickly put down. It allowed the return of the charismatic Francisco de Miranda, vaulted Simà ³n Bolà ­var, Josà © Fà ©lix Ribas and other patriot leaders to fame, and set the stage for the true independence that followed. It also inadvertently caused the death of Simà ³n Bolà ­vars brother Juan Vicente, who died in a shipwreck while returning from a diplomatic mission to the USA in 1811. Sources: Harvey, Robert. Liberators: Latin Americas Struggle for Independence Woodstock: The Overlook Press, 2000. Lynch, John. The Spanish American Revolutions 1808-1826 New York: W. W. Norton Company, 1986. Lynch, John. Simon Bolivar: A Life. New Haven and London: Yale University Press, 2006.