pic16f873 flash microcontroller
TRANSCRIPT
-
7/31/2019 PIC16F873 Flash Microcontroller
1/4
PIC16F873 Flash MicrocontrollerFeeding on the success of PIC16F84, Microchip Technologys PIC16F87X series of microcontrollers aredestined to make a major impact over 8-bit reprogrammable microcontroller arena. PIC16F87X
microcontrollers are built on the popular 14 bit PIC16C core and offer significant improvements over
earlier cousins. As this microcontroller module uses only 28 pin devices (PIC16F873 & PIC16F876),
only these devices are discussed in context of this article. Some features of these devices are highlighted
below.
Memory16F87X microcontrollers carry a large memory array, which can be divided into three types
Flash Program Memory EEPROM Data Memory Data RAM (SRAM)
Flash Program MemoryThe entire program memory is made up of flash array. Every single byte of flash program memory can be
erased and reprogrammed. This can be done either in a conventional PIC programmer such as economical
PICSTART units available from Microchip, or can even be done during an application. And all this canbe done by a small user code resident in program memory, without requiring any external higher
programming voltage. This level of flexibility is very beneficial in todays fast pace development, where
product updates and modifications are routinely carried out in the field.
Reading and writing to program memory through user code is done through a set of special function
registers (SFRs). The program memory is not limited to storing code bytes, but can also be used to store
14 bit of coefficient constants. An accidental access to an invalid code byte will result in execution of
NOP code, without causing any harm. But unfortunately, it cannot be relied upon and care should be
taken to ensure that any coefficient bytes are not accessed as program code bytes.
The lower of the two devices PIC16F873 has 7168 Bytes (4096x14 Words) of code memory while the
other device PIC16F876 has 14336 Bytes (8192x14 Words) of code memory.
EEPROM Data MemoryEEPROM data memory is suitable for multiple erase and write operation. This is normally suitable for
storing coefficient data, which may be programmed from time to time. The EEPROM data memory is not
mapped in register file address space, but is mapped differently, and is also accessed through a set of
SFRs. PIC16F873 contains 128 Bytes of EEPROM data, while PIC16F876 contains 256 Bytes.
Data RAM (SRAM)RAM availability in microcontrollers is increasing steadily and PIC16F series is no exception.
PIC16F873 contains 192 Bytes of SRAM, while PIC16F876 contains a much larger 368 Bytes. The Data
memory is partitioned into 4 banks of 128 Bytes each. The lower section (00 to 20H) of each of thesebanks is devoted to special function registers, and the balance is left for Data RAM. Since PIC16F873only contains 192 Bytes of Data RAM, these are all contained in the first two banks. Only SFRs are
located in the upper two banks bank 2 & bank 3. For PIC16F876 microcontroller containing 368 Bytes of
Data RAM, these are spread in all four banks. This device has an interesting feature that the top 16 Bytes
of each bank are used to address the same data memory space (70 to 7FH). This reduces the need for bank
switching (a real nuisance)
-
7/31/2019 PIC16F873 Flash Microcontroller
2/4
PeripheralsPIC16F87X contains a rich set of on-board peripherals. These include
A/D Converter Timers/Counters/PWM SCI IIC/SPI
FLASH PIC Module
Flash module provides a compact target as well as development base for 28 pin PIC16F873 andPIC16F876 microcontrollers. All the external interface lines including, power supply, RS-232, and
microcontroller I/O are brought to a dual inline connector on one side of the board.
Flexibility of I/O connector makes this module quite versatile. For very simple applications, the connector
can be left out and wires directly soldered to the pc board. But, in general a connector offers moreflexibility. User has a choice of two types of connectors: a right angle pin connector, and a straight pin
connector. Right angle connector is useful for vertical installation in a target application. Straight pin
connector is convenient for horizontal mounting of the module either on top or bottom of another
interface board. It is also useful in situations, where the module is mounted on a flat panel surface and is
connected to interface circuit through ribbon cable.
-
7/31/2019 PIC16F873 Flash Microcontroller
3/4
RS-232 CommunicationA vast majority of microcontroller applications require a serial communication of some sort. An RS-232
voltage translator IC U2 (MAX232 or equivalent) provides the RS-232 interface. Only three interface
lines RX, Tx, and Gnd are used. If for any reason, the module is going to be used in a stand alone
application, without any RS-232 communication, these two I/O lines can be used for external interface. In
this case, IC U2 need not be installed on the board.
A separate 3-pin header provides is provided in addition to the main interface connector. It duplicates the
three interface signals Rx, Tx, and Gnd.
Power SupplyMicrocontroller require a regulated 5 volt dc supply for proper operation. A 5 volt regulator (U2) is
provided onboard. It requires an unregulated dc supply in the range of 812 volt. The unregulated dc isapplied through the last two pins of main interface connector. The regulated 5 volt output is also available
at the interface connector for driving low-power external circuit. Diode D1 protects against accidental
reversal of power supply. If a regulated 5 v supply is available then, the 5 volt regulator circuit can be left
out.
Clock OscillatorPIC16F87X microcontrollers are available for operation at maximum frequencies ranging from 4 MHz to
20 MHz. A popular clock frequency is 4-MHz, which provides a time base of an even 1-microsecond;
convenient in timing applications. Module has the provision to use either a ceramic resonator, or a crystal
(with two capacitors). Resonator offers lower total cost but at the expense of reduction in timing accuracy.For precision timing, such required at high baud rates, it is recommended that a crystal be used.
SPI EEPROMEven though the flash microcontroller contains reprogrammable code and data EEPROM, an external
SPI-EEPROM can be installed on the Flash Module for data user storage. It is interfaced to PIC16F87X
microcontroller through standard SPI interface pins. Interestingly, the interface does not have to use the
hardware SPI facility of microcontroller and can still function using I/O pin manipulation (software SPI).
The write-protect and hold functions of EEPROM are disabled by tying these to Vcc. The EEPROM isselected through port pin PA5. Any SPI device, externa l to Flash Module can still use the built in SPIinterface as long as the on-board EEPROM is not selected (set PA5 to high). Any SPI-EEPROM (8 pin
Dip) of desired capacity can be accommodated.
-
7/31/2019 PIC16F873 Flash Microcontroller
4/4