Tuesday, September 19, 2006

P89LPC9381; 8-bit microcontroller with accelerated two-clock 80C51 core 4 kB 3 V byte-erasable flash with 10-bit ADC

The P89LPC9381 is a single-chip microcontroller, available in low-cost packages, based on a high performance processor architecture that executes instructions in two to four clocks, six times the rate of standard 80C51 devices. Many system-level functions have been incorporated into the P89LPC9381 in order to reduce component count, board space, and system cost.


    Principal features

  • 4 kB byte-erasable flash code memory organized into 1 kB sectors and 64 B pages. Single-byte erasing allows any byte(s) to be used as non-volatile data storage.

  • 256 B RAM data memory on-chip RAM.

  • 8-input multiplexed 10-bit ADC. Two analog comparators with selectable inputs and reference source.

  • Two 16-bit counter/timers (each may be configured to toggle a port output upon timer overflow or to become a PWM output) and a 23-bit system timer that can also be used as a RTC.

  • Enhanced UART with fractional baud rate generator, break detect, framing error detection, and automatic address detection; 400 kHz byte-wide I2C-bus communication port and SPI communication port.

  • High-accuracy internal RC oscillator option allows operation without external oscillator components. The RC oscillator option is selectable and fine tunable.

  • 2.4 V to 3.6 V VDD operating range. I/O pins are 5 V tolerant (may be pulled up or driven to 5.5 V).

  • 28-pin TSSOP package with 23 I/O pins minimum and up to 26 I/O pins while using on-chip oscillator and reset options.


  • Additional features

  • A high performance 80C51 CPU provides instruction cycle times of 111 ns to 222 ns for all instructions except multiply and divide when executing at 18 MHz. This is six times the performance of the standard 80C51 running at the same clock frequency. A lower clock frequency for the same performance results in power savings and reduced EMI.

  • Serial flash ICP allows simple production coding with commercial EPROM programmers. Flash security bits prevent reading of sensitive application programs.

  • Serial flash ISP allows coding while the device is mounted in the end application.

  • In-Application Programming of the flash code memory. This allows changing the code in a running application.

  • Watchdog timer with separate on-chip oscillator, requiring no external components. The watchdog prescaler is selectable from eight values.

  • Low voltage reset (brownout detect) allows a graceful system shutdown when power fails. May optionally be configured as an interrupt.

  • Idle and two different power-down reduced power modes. Improved wake-up from Power-down mode (a LOW interrupt input starts execution). Typical power-down current is 1 uA (total power-down with voltage comparators disabled).

  • Active-LOW reset. On-chip power-on reset allows operation without external reset components. A reset counter and reset glitch suppression circuitry prevent spurious and incomplete resets. A software reset function is also available.

  • Configurable on-chip oscillator with frequency range options selected by user programmed flash configuration bits. Oscillator options support frequencies from 20 kHz to the maximum operating frequency of 18 MHz.

  • Oscillator fail detect. The watchdog timer has a separate fully on-chip oscillator allowing it to perform an oscillator fail detect function.

  • Programmable port output configuration options: quasi-bidirectional, open-drain, push-pull, input-only.

  • Port 'input pattern match' detect. Port 0 may generate an interrupt when the value of the pins match or do not match a programmable pattern.

  • LED drive capability (20 mA) on all port pins. A maximum limit is specified for the entire chip.

  • Controlled slew rate port outputs to reduce EMI. Outputs have approximately 10 ns minimum ramp times.

  • Only power and ground connections are required to operate the P89LPC9381 when internal reset option is selected.

  • Four interrupt priority levels.

  • Eight keypad interrupt inputs, plus two additional external interrupt inputs.

  • Schmitt trigger port inputs.

  • Second data pointer.

  • Emulation support.

Friday, September 15, 2006

Distance Measurement Sensor

GP2Y0A21YK is General Purpose Type Distance Measuring Sensors from Sharp. (see the product page). Sharp Infrared (IR) radiation Distance Measuring Sensor use Infrared signal to measure object distance from 10 to 80 cm with analog output.

Features

  1. Less influence on the color of reflective objects, reflectivity

  2. Line-up of distance output/distance judgement type

    Distance output type (analog voltage) : GP2Y0A21YK

    Detecting distance : 10 to 80cm

    Distance judgement type : GP2Y0D21YK

    Judgement distance : 24cm

    (Adjustable within the range of 10 to 80cm [Optionally available])

  3. External control circuit is unnecessary

  4. Low cost

Applications

  1. TVs

  2. Personal computers

  3. Cars

  4. Copiers

  5. Robots

The output of this sensor is analog therefore it need Analog to Digital Converter (ADC) to interface the 8051. I use ads7841 as ADC (see this article).

The graph of Analog voltage output versus distance to reflective object are shown in Fig.1. When I plot Analog voltage output versus inverse number distance, I found the linear relation shown in Fig.2.

Fig. 1 Analog voltage output (V) versus distance to reflective object (cm).


Fig. 2 Analog voltage output (V) versus inverse number distance (1/cm).

The linear equation is y = 20.99x + 0.19, where y is voltage output and x invert distance. Notice that the voltage output I can trust are about 0.4 to 2.8 V.

This is an example code how to interface the distance sensor to 8051. I use SDCC as C Compiler.


#include <8051.h>

#include "ads7841.h"


void main()

{

float x,y; // Distance and Analog voltage output


y = analog(0); // Read volt out if the sensor connect to channel 0 of ADS7841


y = 0.00122*y; // Convert BCD to DEC by multiply voltage by 5/4096



if ( (y > 0.4) && (y < 2.8) ) {

x = (y-0.19)/20.99; // Solve the linear equation

x = 1/x; // Inverse back get distance in cm.

}

}



Source:
test_irsensor.c
characteristic.txt (For plot with Spreadsheet)

Related Links

GP2Y0A21YK/GP2Y0D21YK Datasheet
Analog to Digital (ADS7841) Interfacing

Servo Motor Control


Servos

Servos are DC motors with built in gearing and feedback control loop circuitry. And no motor drivers required. They are extremely popular with robot, RC plane, and RC boat builders. Most servo motors can rotate about 90 to 180 degrees. Some rotate through a full 360 degrees or more.

However, servos are unable to continually rotate, meaning they can't be used for driving wheels, unless they are modified (how to modify), but their precision positioning makes them ideal for robot legs and arms, rack and pinion steering, and sensor scanners to name a few. Since servos are fully self contained, the velocity and angle control loops are very easy to impliment, while prices remain very affordable. To use a servo, simply connect the black wire to ground, the red to a 4.8-6V source, and the yellow/white wire to a signal generator (such as from your microcontroller). Vary the square wave pulse width from 1-2 ms and your servo is now position/velocity controlled.


PWM

Pulse width modulation (PWM) is a powerful technique for controlling analog circuits with a processor's digital outputs. PWM is employed in a wide variety of applications, ranging from measurement and communications to power control and conversion. The general concept is to simply send an ordinary logic square wave to your servo at a specific wave length, and your servo goes to a particular angle (or velocity if your servo is modified). The wavelength directly maps to servo angle.The standard time vs angle is represented in this chart:

Figure: Pulse for controlling a Servo motor


Programmable Counter Array (PCA)

The PCA is a special modules in Philips P89V51RD2 which includes a special 16-bit Timer that has five 16-bit capture/compare modules associated with it. Each of the modules can be programmed to operate in one of four modes: rising and/or falling edge capture, software timer, high-speed output, or pulse width modulator. Each module has a pin associated with it in port 1.
Module 0 is connected to P1.3 (CEX0), module 1 to P1.4 (CEX1), etc. Registers CH and CL contain current value of the free running up counting 16-bit PCA timer. The PCA timer is a common time base for all five modules and can be programmed to run at: 1/6 the oscillator frequency, 1/2 the oscillator frequency, the Timer 0 overflow, or the input on the ECI pin (P1.2). The timer count source is determined from the CPS1 and CPS0 bits in the CMOD SFR.

In the CMOD SFR there are three additional bits associated with the PCA. They are CIDL which allows the PCA to stop during idle mode, WDTE which enables or disables the Watchdog function on module 4, and ECF which when set causes an interrupt and the PCA overflow flag CF (in the CCON SFR) to be set when the PCA timer overflows. The Watchdog timer function is implemented in module 4 of PCA. Here, we are interested only PWM mode.


8051 Pulse width modulator mode

All of the PCA modules can be used as PWM outputs. Output frequency depends on the source for the PCA timer. All of the modules will have the same frequency of output because they all share one and only PCA timer. The duty cycle of each module is independently variable using the module's capture register CCAPnL.When the value of the PCA CL SFR is less than the value in the module's CCAPnL SFR the output will be low, when it is equal to or greater than the output will be high. When CL overflows from FF to 00, CCAPnL is reloaded with the value in CCAPnH. this allows updating the PWM without glitches. The PWM and ECOM bits in the module's CCAPMn register must be set to enable the PWM mode. For more details see P89V51RD2 datasheet.

This is an example how to control servos with 8051 by using PWM. The schematic is shown below. I use P1.4 (CEX1) to control the left servo and P1.2 (CEX2) to control the right servo. Here, I use GWS servo motor model S03T STD. I need three states of duty cycle:

  • 20 ms to Stop the servo

  • 1 ms to Rotate Clockwise

  • 2 ms to Rotate Counter-clockwise


Calculation for duty cycle (for XTAL 18.432 MHz with 6 Clock/Machine cycle)

  • Initial PWM Period = 20mS (18.432MHz /6-Cycle Mode)

  • Initial PCA Count From Timer0 Overflow

  • 1 Cycle of Timer0 = (1/18.432MHz)x6 = 0.326 uS

  • Timer0 AutoReload = 240 Cycle = 78.125 uS

  • 1 Cycle PCA = [(1/18.432MHz)x6]x240 = 78.125 uS

  • Period 20mS of PCA = 20ms/78.125us = 256 (CL Reload)

  • CL (20mS) = 256 Cycle Auto Reload

  • Load CCAPxH (1.0mS) = 256-13 = 243 (243,244,...,255 = 13 Cycle)

  • Load CCAPxH (2.0mS) = 255-26 = 230 (230,231,...,255 = 26 Cycle)

Schematic: Control RC Servos motors with 8051 PWM


Datasheet

- P89V51RD2 [pdf]


Source Code (For SDCC)

- pwm_servos.h

- test_servos.c


Related Links

- What is a Servo?

- Tutorial on how to modify a servo for full 360 degree rotation

- Servo Tutorial for Robotics

- Pulse-width modulation (Wiki)

- Introduction to Pulse Width Modulation (PWM)

EEPROMs Interfacing


24LC512 is a 64K x 8 (512 Kbit) Serial Electrically Erasable PROM (EEPROMs), from Microchip Technology Inc. (see the product page). It has been developed for advanced, low-power applications such as personal communications and data acquisition. This device also has a page write capability of up to 128 bytes of data.

This device is capable of both random and sequential reads up to the 512K boundary. Functional address lines allow up to eight devices on the same bus, for up to 4 Mbit address space.

This is an example how to interface 24XXX EEPROMs with 8051. I use SDCC as C Compiler. My schematic is shown below.

Schematic: 8051 interface to 24XXX EEPROMs

Datasheet
- 24LC512 [pdf]

Source Code (For SDCC)
- 24xx512.h
- test_eeprom.c

Note: require lcd.h and i2c.h


Related Links
-24LC512 Products Page
-Interfacing I2C EEPROM (24LC256) with MCS-51 (KEIL C51)

Saturday, September 9, 2006

Real Time Clock Interfacing


DS1307, a 64 x 8, Serial, I2C Real-Time Clock, is a low-power, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially through an I2C, bidirectional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. It a product of Maxim/Dallas Semiconductor, see the product page.

This is an example how to interface DS1307 with 8051. I use SDCC as C Compiler. My schematic is shown below.

Schematic: 8051 interface to DS1307

Datasheet
- DS1307 [pdf]

Source Code (For SDCC)
- ds1307.h
- test_ds1307.c

Note: require lcd.h and i2c.h


Related Links
- DS1307 Products Page
- Interfacing I2C RTC (DS1307) with MCS-51 (KEIL C51)

I²C Bus Interfacing

I²C bus (Inter-Integrated Circuit) is a bidirectional, half duplex, two-wire, synchoronous bus, originally designed for interconnection over short distances within a piece of equipment. The I2C bus uses two lines called Serial Clock Line (SCL) and Serial Data Lines (SDA). Both lines are pulled high via a resistor (Rpu) as shown in Figure below. The bus is defined by Philips, see more details.

Three speed modes are specified: Standard; 100kbps [Bits per Second], Fast mode; 400kbps, High speed mode 3.4Mbps. I2C, due to its two-wire nature (one clock, one data) can only communicate half-duplex. The maximum bus capacitance is 400pF, which sets the maximum number of devices on the bus and the maximum line length.

The interface uses 8 bit long bytes, MSB (Most Significant Bit) first, with each device having a unique address. Any device may be a Transmitter or Receiver, and a Master or Slave. The Slave is any device addressed by the Master. A system may have more than one Master, although only one may me active at any time.

Data and clock are sent from the Master: valid while the clock line is high. The link may have multiple Masters and Slaves on the bus, but only one Master may be active at any one time. Slaves may receive or transmit data to the master.

This is an example how to interface I²C with 8051. I use SDCC as C Compiler. My schematic is shown below. I set P2.6 as SCL and P2.7 as SDA.

Schematic: I²C Bus

Datasheet
I²C-Bus Specification [pdf]

Source Code (For SDCC)
- i2c.h

Note: see DS1307 and 24LC512 for applications


Related Links
- Philips I²C Bus
- I2C (Inter-Integrated Circuit) Bus Technical Overview and Frequently Asked Questions (FAQ)
- I²C Bus and Access Bus
- http://www.i2c-bus.org/

Friday, September 8, 2006

Analog-to-Digital Interfacing


The ADS7841 is a 4-channel, 12-bit sampling Analog-to-Digital Converter (ADC) with a synchronous serial interface. The resolution is programmable to either 8 bits or 12 bits. It is a product of Burr-Brown form Texas Instrument, see the product page.

This ADC give the 12-bit Binary Code Decimal (BCD) output value therefore the maximum value is 999 integer. If we want to convert this value to the real value, we must divide this value by 4096 (12-bit) and multiply by the maximum real ouput. Suppose the real maximum of output is 5V, the ratio should be 5/4096 = 0.00122. We can use 0.00122 multiply the output from ADS7841 to get the real ouput value.

This is an example how to interface ADS7841 with 8051. I use SDCC as C Compiler. My schematic is shown below. I still do not convert to the real value so my variables are integer.

Schematic: 8051 interface to ADS7841

Datasheet
- ADS7841 [pdf]

Source Code (For SDCC)
- ads7841.h
- test_ads7841.c

Note: require lcd.h


Related Links
- ADS7841 Products Page

Thursday, September 7, 2006

LCD interfacing


This is an example how to interface to the standard Hitachi-44780 LCD using an 8051 microcontroller and SDCC as C Compiler. I use a standard 16-character by 2-line LCD module, see schematic below. Here, I use 4-bit interfacing.


Schematic: 4-bit interfacing 16x2 LCD

Source Code (For SDCC)
- lcd.h
- test_lcd.c


Related Links
- How to control a HD44780-based Character-LCD: The Industry Standard Character LCD
- Yet Another 8051-to-LCD Interface
- Interfacing: Converting 8-bit LCD communication to 4-bit

Tuesday, September 5, 2006

Installing MIDE-51 and SDCC and for Win32

This page is an installation guide for someone who are interested in developing 8051 microcontrllor with C-language. All of tools I selected are freeware or opensource with no limitation of number of lines of your code.

Contents

  1. Installing MIDE-51, Editor for 8051

  2. Installing SDCC, C Compiler for 8051

  3. Installing ASEM-51, Assembler for 8051

  4. Installing JSIM-51, Simulator for 8051

  5. Installing FlashMagic, ISP for Philips MPU

  6. Configuration

  7. Test


1. Installing MIDE-51
MIDE-51 is freeware Integrated Development Environment (IDE) for MCS-51 microcontroller. The full package already comes with:

Assembler : ASEM-51 by W.W.Heinz (v1.3)
C compiler : SDCC: Small Device C Compiler (v2.5.4)
Simulator : TS Controls 8051 Emulator v1.0 evaluation (Owner : http://www.tscontrols.com was gone)
Simulator : JSIM-51 Simulator by Jens Altmann (v4.05)

Just downloads midepack0258.exe and executes this file, everything will setup completely.

Feature on MIDE-51:

  • Syntax highlighter on ASEM-51 reserved word & addition register on selected device (devices listed on ASEM51/MCU folder)

  • Syntax highlighter on SDCC reserved word & MCS-51 standard register

  • Support multi document workspace

  • Support standard editor feature and shortcut key such as Cut , Copy, Paste, Find, Replace and Windows tile & cascade

  • Editor font style and size selectable

  • Save recent file(s) opened in list

  • Shortcut to ASEM-51 html manual

  • Shortcut to SDCC html & PDF manual (search file on SDCC/DOC)

  • Report assembler & compiler message

  • Support drag and drop file from explorer.

  • Automatic save last windows position.

  • Support wheel mouse

  • Bookmark code position upto 10

  • Show/Hide line number on editor

However, if you would like to use the newer version of them, you can also install each package manualy. First, downloads only editor version of MIDE-51 ( MIDE51_0258.zip) and extracts it to any directory (C:\MIDE51). You should have C:\MIDE51\MIDE51.EXE. For others package, please follow these instructions.


2. Installing SDCC
SDCC is a Freeware, retargettable, optimizing ANSI - C compiler that targets the Intel 8051, Maxim 80DS390, Zilog Z80 and the Motorola 68HC08 based MCUs. Work is in progress on supporting the Microchip PIC16 and PIC18 series. The entire source code for the compiler is distributed under GPL.

To install the SDCC, download the latest version from http://sdcc.sourceforge.net/snap.php#Windows (currently v2.6.x). SDCC are available for several different operating systems. I am working on a PC running Microsoft Windows XP therefore I download the win32 self-executing SDCC install file
(sdcc-20060818-4339-setup.exe) and run the executable. By default, it will install all files to C:\Program Files\SDCC, you also can change to any directory.

When finishing installing the program, a prompt will appear asking to add the directory containing the program binaries to your PATH. I also recommend you to download the SDCC documentation (sdcc-doc-20060818-4339.zip), and extract it to your SDCC documentation directory (C:\Program Files\SDCC\doc).


3. Installing ASEM-51
ASEM-51 is a two-pass macro assembler for the Intel MCS-51 family of microcontrollers. It is running on the PC under MS-DOS, Windows and Linux. The ASEM-51 assembly language is based on the standard Intel syntax, and implements conditional assembly, macros, and include file processing. The assembler can output object code in Intel-HEX or Intel OMF-51 format as well as a detailed list file. The ASEM-51 package includes support for more than 180 8051 derivatives, a bootstrap program for MCS-51 target boards, and documentation in ASCII and HTML format. And it is free ...

The simplest way of installing ASEM-51 is copying all files of the package to your working directory, and enjoy the benefits of true plug-and-play compatibility!. Alternatively, I have set it up on Windows XP manually:

  • Downloads the lastest ASEM-51 for DOS/Windows (currently v1.3)

  • Create a new, empty directory on your harddisk (C:\ASEM51).

  • Unpack your ASEM-51 distribution archive into this directory, or copy all files of the ASEM-51 package into it.

  • Make the scratch directory default, run the batch file INSTALL.BAT provided, and follow the instructions.

  • Reboot your PC.

You can update MPU file by downloading http://plit.de/asem-51/mcufiles.zip.


4. Installing JSIM-51
JSIM-51 is a powerful software simulator for 8051 Microcontrollers and it's derivatives. The program simulates the processor kernel and some of the hardware functions. It was born due to all commercial products are too expensive for private users. It is free and opensource.

To install:

  • Download 8051.zip ( DLL for simulation of a standard-8051 , V1.017 - 09/17/1998)

  • Download 80320.zip ( DLL for simulation of a 80320 -Dallas , V1.019 - 10/03/2000)

  • Download jsim_e.zip ( english version V4.05 from 01/08/2000)

Extract all files i.e., jsim.exe, 8051.dll and 80320.dll to your directory (C:\Jsim51).


5. Installing FlashMagic ISP Software
Flash Magic is a free, powerful, feature-rich Windows application that allows easy programming of Philips Flash Microcontrollers. Its function is to download compiled HEX file to your (Philips) microcontroller.

Please download and install the current version of FlashMagic.exe here.


6. Configuration
To combine every things:

  • Execute MIDE-51.exe

  • From menu bar, Edit-->Preference (F12)

  • Click Tab C-Compiler, Edit your SDCC Path (C:\Program Files\SDCC)

  • Click Tab Assembler, Edit your ASEM-51 Path (C:\ASEM51).

  • Click Tab Simulaotr, Simulator Profile, select JSIM with 8051.dll, edit Execute file (Full path and filename) C:\JSIM51\jsim.exe.

  • Now, everything is complete


7. Test

Execute MIDE-51.exe and File-->New (Ctrl+N), edit this code

#include <p89v51rd2.h>
unsigned char i;
void main() {
i=10;
}
Save to anyname.c and then Build (F9). You will found many files in the directory, one of them is .HEX file which can be downloaded to your MCU by using FlashMagic. Or, you can simulate it by using Jsim51, Build and Sim (Shift+Ctrl+F9).

Note: I tested on my P89V51RD2 MPU. Enjoy your 8051 microcontroller.


Related Links

Product Page: http://www.semiconductors.philips.com/

Data Sheet: P89V51RB2_RC2_RD2-03.pdf

Boot Loader: p89v_lv51rd2_bl_upd_v5.zip

FlashMagic ISP Software: http://www.esacademy.com/

SDCC : http://sdcc.sourceforge.net/

MIDE-51 : http://www.opcube.com/home.html

ASEM-51 : http://plit.de/asem-51/home.htm

JSIM-51 : http://home.arcor.de/jensaltmann/jsim-e.htm

Monday, September 4, 2006

Introduction to SDCC: Small Device C Compiler

SDCC is a Freeware, retargettable, optimizing ANSI - C compiler that targets the Intel 8051, Maxim 80DS390, Zilog Z80 and the Motorola 68HC08 based MCUs. Work is in progress on supporting the Microchip PIC16 and PIC18 series. AVR and gbz80 ports are no longer maintained. The entire source code for the compiler is distributed under GPL.

Some of the features include:

  • ASXXXX and ASLINK, a Freeware, retargettable assembler and linker.

  • extensive MCU specific language extensions, allowing effective use of the underlying hardware.

  • a host of standard optimizations such as global sub expression elimination, loop optimizations (loop invariant, strength reduction of induction variables and loop reversing ), constant folding and propagation, copy propagation, dead code elimination and jump tables for 'switch' statements.

  • MCU specific optimisations, including a global register allocator.

  • adaptable MCU specific backend that should be well suited for other 8 bit MCUs

  • independent rule based peep hole optimizer.

  • a full range of data types: char (8 bits, 1 byte), short (16 bits, 2 bytes), int (16 bits, 2 bytes), long (32 bit, 4 bytes) and float (4 byte IEEE).

  • the ability to add inline assembler code anywhere in a function.

  • the ability to report on the complexity of a function to help decide what should be re-written in assembler.

  • a good selection of automated regression tests.

SDCC also comes with the source level debugger SDCDB, using the current version of Daniel's s51 simulator. (Currently not available on Win32 platforms).

SDCC was written by Sandeep Dutta and released under a GPL license. Since its initial release there have been numerous bug fixes and improvements. As of December 1999, the code was moved to SourceForge where all the "users turned developers" can access the same source tree. SDCC is constantly being updated with all the users' and developers' input.

SDCC Homepage
- http://sdcc.sourceforge.net/

Sunday, September 3, 2006

Philips P89V51RD2 Microcontroller

I am using Philips P89V51RD2 as 8051 Microcontroller Unit (MCU). And I have been developing my code with Opensouce C Compiler SDCC. Please visit my Tools page for software preparation guides.

The P89V51RD2 is a 80C51 microcontroller with 64 kB Flash and 1024 bytes of data RAM. A key feature of the P89V51RD2 is its X2 mode option. The design engineer can choose to run the application with the conventional 80C51 clock rate (12 clocks per machine cycle) or select the X2 mode (6 clocks per machine cycle) to achieve twice the throughput at the same clock frequency. Another way to benefit from this feature is to keep the same performance by reducing the clock frequency by half, thus dramatically reducing the EMI.

The Flash program memory supports both parallel programming and in serial In-System Programming (ISP). Parallel programming mode offers gang-programming at high speed, reducing programming costs and time to market. ISP allows a device to be reprogrammed in the end product under software control. The capability to field/update the application firmware makes a wide range of applications possible.

The P89V51RD2 is also In-Application Programmable (IAP), allowing the Flash program memory to be reconfigured even while the application is running.

Features

  • 80C51 Central Processing Unit

  • 5 V Operating voltage from 0 MHz to 40 MHz

  • 64 kB of on-chip Flash user code memory with ISP (In-System Programming) and IAP (In-Application Programming)

  • Supports 12-clock (default) or 6-clock mode selection via software or ISP

  • SPI (Serial Peripheral Interface) and enhanced UART

  • PCA (Programmable Counter Array) with PWM and Capture/Compare functions

  • Four 8-bit I/O ports with three high-current Port 1 pins (16 mA each)

  • Three 16-bit timers/counters

  • Programmable watchdog timer

  • Eight interrupt sources with four priority levels

  • Second DPTR register

  • Low EMI mode (ALE inhibit)

  • TTL- and CMOS-compatible logic levels

  • Brown-out detection

  • Low power modes

    o Power-down mode with external interrupt wake-up

    o Idle mode

  • DIP40 packages

Related Links
Product Page: http://www.semiconductors.philips.com/
Data Sheet: P89V51RB2_RC2_RD2-03.pdf
Boot Loader: p89v_lv51rd2_bl_upd_v5.zip
FlashMagic ISP Software: http://www.esacademy.com/

Saturday, September 2, 2006

Introduction to 8051 Microcontroller

The 8051 is an 8 bit microcontroller originally developed by Intel in
1980. It is the world's most popular microcontroller core, made by
many independent manufacturers (truly multi-sourced). There were 126
million 8051s (and variants) shipped in 1993!!

A typical 8051 contains:

  • CPU with boolean processor

  • 5 or 6 interrupts:
    2 are external

    2 priority levels

  • 2 or 3 16-bit timer/counters

  • programmable full-duplex serial port
    (baud rate provided by one of the timers)

  • 32 I/O lines (four 8-bit ports)

  • RAM

  • ROM/EPROM in some models

One strong point of the 8051 is the way it handles interrupts.
Vectoring to fixed 8-byte areas is convenient and efficient. Most
interrupt routines are very short (or at least they should be), and
generally can fit into the 8-byte area. Of course if your interrupt
routine is longer, you can still jump to the appropriate routine from
within the 8 byte interrupt region.

The 8051 instruction set is optimized for the one-bit operations so
often desired in real-world, real-time control applications. The
boolean processor provides direct support for bit manipulation. This
leads to more efficient programs that need to deal with binary input
and output conditions inherent in digital-control problems. Bit
addressing can be used for test pin monitoring or program control
flags.


See full information from 8051 FAQ
- http://www.faqs.org/faqs/microcontroller-faq/8051/