TB025 Microchip Technology, TB025 Datasheet

no-image

TB025

Manufacturer Part Number
TB025
Description
Microcontrollers
Manufacturer
Microchip Technology
Datasheet
www.DataSheet4U.com
INTRODUCTION
The release of the PIC16F87X devices introduces the
first mid-range family of devices from Microchip Tech-
nology that has the capability to read and write to inter-
nal program memory. This family has FLASH-based
program memory, SRAM data memory and EEPROM
data memory. The FLASH program memory allows for
a truly reprogrammable system. Table 1 shows the fea-
tures of the PIC16F87X family of devices.
TABLE 1
M
Downloading HEX Files to PIC16F87X PICmicro
Operating Frequency
Resets
Flash Prog Memory (14-bit words)
Data Memory (bytes)
EEPROM Data Memory
Interrupts
I/O Ports
Timers
Capture/Compare/PWM modules
Serial Communications
Parallel Communications
10-bit Analog-to-Digital Module
1998 Microchip Technology Inc.
Author:
Key Features
Rodger Richey
Microchip Technology Inc.
PIC16F87X FAMILY FEATURES
DC - 20 MHz
POR, BOR
4K
192
128
13
Ports A,B,C
3
2
MSSP, USART
5 input channels
PIC16F873
DC - 20 MHz
POR, BOR
4K
192
128
14
Ports A,B,C,D,E
3
2
MSSP, USART
PSP
8 input channels
PIC16F874
ACCESSING MEMORY
The read and write operations are controlled by a set of
Special Function Registers (SFRs). There are six
SFRs required to access the FLASH program memory:
• EECON1
• EECON2
• EEDATA
• EEDATH
• EEADR
• EEADRH
The registers EEADRH:EEADR holds the 12-bit address
required to access a location in the 8K words of pro-
gram memory. The registers EEDATH:EEDATA are used
to hold the data values. When reading program mem-
ory, the EEPGD bit (EECON1<7>) must be set to indicate
to the microcontroller that the operation is going to be
on program memory. If the bit is cleared, the operation
will be performed on data memory at the address
pointed to by EEADR . The EEDATA register will hold the
data. The EECON1 register also has bits for write enable
and to initiate the read or write operation. There is also
a bit to indicate a write error has occurred, possibly due
to a reset condition happening while a write operation
is in progress. Figure 1 shows the register map for
EECON1 .
The EECON2 register is not a physical register. Reading
it will result in all '0's. This register is used exclusively
in the EEPROM and FLASH write sequences.
shows the code snippet to initiate a write operation on
the PIC16F87X devices.
DC - 20 MHz
POR, BOR
8K
368
256
13
Ports A,B,C
3
2
MSSP, USART
5 input channels
PIC16F876
®
Microcontrollers
TB025
DC - 20 MHz
POR, BOR
8K
368
256
14
Ports A,B,C,D,E
3
2
MSSP, USART
PSP
8 input channels
DS91025A-page 1
PIC16F877
Listing 1

Related parts for TB025

TB025 Summary of contents

Page 1

... Ports A,B,C Ports A,B,C,D,E Ports A,B MSSP, USART MSSP, USART MSSP, USART — PSP — 5 input channels 8 input channels 5 input channels TB025 ® Microcontrollers Listing 1 PIC16F876 PIC16F877 MHz POR, BOR 8K 368 256 14 Ports A,B,C,D MSSP, USART PSP 8 input channels DS91025A-page 1 ...

Page 2

... TB025 FIGURE 1: EECON1 REGISTER R/W-x U-0 U-0 EEPGD — — bit7 bit 7: EEPGD : Program / Data EEPROM Select bit 1 = Accesses Program memory 0 = Accesses data memory Note: This bit cannot be changed while a write operation is in progress. bit 6:4: Unimplemented: Read as '0' www.DataSheet4U.com bit 3: WRERR : EEPROM Error Flag bit ...

Page 3

... Listing 2 shows the complete listing for the downloader code. 1998 Microchip Technology Inc. TB025 The routine ASCII2HEX converts the input character to a binary number. The routine does not provide any out of range error checking for incoming characters. Since the only valid characters in a HEX file are the colon (:), the numbers 0 through 9 and the letters A through F, the routine can be highly optimized. It fi ...

Page 4

... TB025 LISTING 2: HEX DOWNLOAD CODE WRITTEN FOR MPASM list p=16f877 #include "c:\progra~1\mplab\p16f877.inc" DownloadCode banksel RCREG DCStart call GetByte movlw ':' subwf RCREG,W btfss STATUS,Z goto DCStart call GetHex8 movwf ByteCount movwf LineChecksum www.DataSheet4U.com bcf STATUS,C rrf ByteCount,F call GetHex8 movwf ...

Page 5

... USART GetByte ;Read a character from the USART ASCII2Hex ;Convert the character to binary Temp ;Store result in high nibble Temp,F GetByte ;Read a character from the USART ASCII2Hex ;Convert the character to binary Temp,F ;Store result in low nibble Temp,W ;Move result into WREG TB025 DS91025A-page 5 ...

Page 6

... TB025 ASCII2Hex movwf Temp1 movlw '0' subwf Temp1,F movlw 0xf0 andwf Temp1,W btfsc STATUS,Z goto ASCIIOut movlw 'A'-'0'-0x0a subwf Temp1,F ASCIIOut movf Temp1,W return end www.DataSheet4U.com DS91025A-page 6 ;Convert value to binary ;Subtract ASCII 0 from number ;If number is 0-9 result, upper nibble ; should be zero ;Otherwise, number ...

Page 7

... Yes Return with Yes Yes No Read Checksum and add to LineChecksum Result = Return with TB025 3 Move AddrH:AddrL No 1 into EEADRH:EEADR Move HexDataH:HexDataL into EEDATH:EEDATA Set EEPGD and WREN bits No Write 55h to EECON2 Return with Write AAh to EECON2 ...

Page 8

... Information contained in this publication regarding device applications and the like is intended for suggestion only and may be superseded by updates. No representation or warranty is given and no liability is assumed by Microchip Technology Incorporated with respect to the accuracy or use of such information, or infringement of patents or other intellectual property rights arising from such use or otherwise. Use of Microchip’ ...

Related keywords