TB025 Microchip Technology, TB025 Datasheet - Page 4
![no-image](/images/manufacturer_photos/0/4/439/microchip_technology_sml.jpg)
TB025
Manufacturer Part Number
TB025
Description
Microcontrollers
Manufacturer
Microchip Technology
Datasheet
1.TB025.pdf
(8 pages)
www.DataSheet4U.com
TB025
LISTING 2:
DownloadCode
DCStart
DataRec
DRLoop
WriteDataSequence
DS91025A-page 4
list p=16f877
#include "c:\progra~1\mplab\p16f877.inc"
banksel
call
movlw
subwf
btfss
goto
call
movwf
movwf
bcf
rrf
call
movwf
addwf
call
movwf
addwf
call
movwf
addwf
movf
btfss
goto
movf
btfsc
goto
call
movwf
addwf
call
movwf
addwf
banksel
movf
movwf
movf
movwf
movf
movwf
movf
movwf
banksel
bsf
bsf
bcf
movlw
movwf
movlw
movwf
bsf
nop
HEX DOWNLOAD CODE WRITTEN FOR MPASM
RCREG
GetByte
':'
RCREG,W
STATUS,Z
DCStart
GetHex8
ByteCount
LineChecksum
STATUS,C
ByteCount,F
GetHex8
AddrH
LineChecksum,F
GetHex8
AddrL
LineChecksum,F
GetHex8
RecType
LineChecksum,F
RecType,F
STATUS,Z
EndOfFileRec
ByteCount,F
STATUS,Z
DRCkChecksum
GetHex8
HexDataL
LineChecksum,F
GetHex8
HexDataH
LineChecksum,F
EEADRH
AddrH,W
EEADRH
AddrL,W
EEADR
HexDataH,W
EEDATH
HexDataL,W
EEDATA
EECON1
EECON1,EEPGD
EECON1,WREN
INTCON,GIE
0x55
EECON2
0xaa
EECON2
EECON1,WR
;Uses USART to receive data from PC
;Wait for colon
;Read byte count
;Store in register
;Store in line checksum
;Divide byte counter by 2 to get words
;Read high byte of 16-bit address
;Add high byte to line checksum
;Read low byte of 16-bit address
;Add low byte to line checksum
;Read record type
;Add to line checksum
;Data reception
;Check for data record (0h)
;Otherwise check for EOF
;Check for bytecount = 0
;If zero, goto checksum validation
;Read lower byte of data (2 characters)
;Add received data to checksum
;Read upper byte of data (2 characters)
;Add received data to checksum
;Write sequence to internal prog. mem FLASH
;Write address to EEADRH:EEADR registers
;Write data to EEDATH:EEDATA registers
;Write sequence
;Set EEPGD to indicate program memory
;Enable writes to memory
;Make sure interrupts are disabled
;Required write sequence
;Start internal write cycle
1998 Microchip Technology Inc.