93LC56CT-I/STG
更新时间:2024-09-18 13:03:50
品牌:MICROCHIP
描述:128 X 16 MICROWIRE BUS SERIAL EEPROM, PDSO8, 4.40 MM, ROHS COMPLIANT, PLASTIC, TSSOP-8
93LC56CT-I/STG 概述
128 X 16 MICROWIRE BUS SERIAL EEPROM, PDSO8, 4.40 MM, ROHS COMPLIANT, PLASTIC, TSSOP-8 EEPROM
93LC56CT-I/STG 规格参数
是否无铅: | 不含铅 | 是否Rohs认证: | 符合 |
生命周期: | Active | 零件包装代码: | SOIC |
包装说明: | TSSOP, TSSOP8,.25 | 针数: | 8 |
Reach Compliance Code: | compliant | ECCN代码: | EAR99 |
HTS代码: | 8542.32.00.51 | 风险等级: | 5.19 |
备用内存宽度: | 8 | 最大时钟频率 (fCLK): | 2 MHz |
数据保留时间-最小值: | 200 | 耐久性: | 1000000 Write/Erase Cycles |
JESD-30 代码: | R-PDSO-G8 | JESD-609代码: | e3 |
长度: | 4.4 mm | 内存密度: | 2048 bit |
内存集成电路类型: | EEPROM | 内存宽度: | 16 |
湿度敏感等级: | 1 | 功能数量: | 1 |
端子数量: | 8 | 字数: | 128 words |
字数代码: | 128 | 工作模式: | SYNCHRONOUS |
最高工作温度: | 85 °C | 最低工作温度: | -40 °C |
组织: | 128X16 | 封装主体材料: | PLASTIC/EPOXY |
封装代码: | TSSOP | 封装等效代码: | TSSOP8,.25 |
封装形状: | RECTANGULAR | 封装形式: | SMALL OUTLINE, THIN PROFILE, SHRINK PITCH |
并行/串行: | SERIAL | 峰值回流温度(摄氏度): | 260 |
电源: | 3/5 V | 认证状态: | Not Qualified |
座面最大高度: | 1.2 mm | 串行总线类型: | MICROWIRE |
最大待机电流: | 0.000001 A | 子类别: | EEPROMs |
最大压摆率: | 0.002 mA | 最大供电电压 (Vsup): | 5.5 V |
最小供电电压 (Vsup): | 2.5 V | 标称供电电压 (Vsup): | 5 V |
表面贴装: | YES | 技术: | CMOS |
温度等级: | INDUSTRIAL | 端子面层: | Matte Tin (Sn) |
端子形式: | GULL WING | 端子节距: | 0.65 mm |
端子位置: | DUAL | 处于峰值回流温度下的最长时间: | 40 |
宽度: | 3 mm | 最长写入周期时间 (tWC): | 6 ms |
写保护: | SOFTWARE | Base Number Matches: | 1 |
93LC56CT-I/STG 数据手册
通过下载93LC56CT-I/STG数据手册来全面了解它。这个PDF文档包含了所有必要的细节,如产品概述、功能特性、引脚定义、引脚排列图等信息。
PDF下载AN560
Using the 93LC56 and 93LC66
3-Wire Byte Write Program
INTRODUCTION
– Delay Routine
The Microchip Technology Inc. 93LC56/66 are low-
power 3-wire non-volatile memories and are suitable for
manyembeddedsystemcodeanddatastorageapplica-
tions. Thesedevicesareeasilyinterfacedtomostmicro-
controllers in today's market place, but Microchip’s 8-bit
RISC series PIC16CXX offers the best code density of
any microcontroller on the market today. Using the
PIC16C54, the assembly programs contained in this
application note have been fully tested and provide the
correct timing and 3-wire sequences to fully operate the
93LC56/66 in a PIC16CXX-based embedded applica-
tion. The PIC16C54 was clocked at a 10MHz frequency.
This application note is intended to provide the engineer
with readily available stand-alone code modules to
accomplishallofthenecessaryfunctionstoutilize these
devices in a low power application using the efficient
PIC16C54 microcontroller.
– Start Bit Routine
– Bit Out Routine
– Transmit Data Routine
– Power-up Routine
– Erase/Write Enable Routine (EWEN)
– Byte Write Routine
– Erase/Write Disable Routine (EWDS)
3-Wire Byte Write with Data Polling Program
– Data Polling Delay Routine
– Start Bit Routine
– Bit Out Routine
The 93 series of devices have essentially four I/O pins:
– Transmit Data Routine
– Power-up Routine
CS
CLK
DI
Chip Select
Clock
– Erase/Write Enable Routine
– Write Routine
Data In
DO
Data Out
– Erase/Write Disable Routine (EWDS)
This series of devices use a series of commands to
accomplish the normal memory functions. These are
READ, WRITE, EWEN, ERASE, ERAL, WRAL, EWDS.
For a more detailed discussion of the function of these
devicesreferencetheappropriatedatasheetandAN536,
also published by Microchip Technology.
3-Wire Sequential Read Program
– Delay Routine
– Start Bit Routine
– Bit In Routine
– Receive Data Routine
– Bit Out Routine
– Transmit Data Routine
– Power-up Routine
– Read Routine
The following programs are included in this application
note and are fully functional stand-alone modules. They
are intended for use by those who are not already
familiar with interfacing a PIC16CXX microcontroller to
a 93 series device. For those with more experience,
please refer to application note AN530.
8
3-Wire Byte Read Program
– Start Bit Routine
– Receive Data Routine
– Bit Out Routine
Author:
Bruce Negley
Memory Products Division
– Transmit Data Routine
– Power-up Routine
– Read Routine
© 1994 Microchip Technology Inc.
DS00560D-page 1
8-99
Using the 93LC56 and 93LC66
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:10 1994 Page 1
Line
PC
Opcode
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
LIST P=16C54,c=132
;****************************************************************
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
3-Wire Byte Read Program (80 bytes)
This program demonstrates how to interface a
Microchip PIC16C54 to a 93LC56 or 93LC66 Serial EE
device. This program will read 8 consecutive addresses
in the ‘random read’ mode. This means that the opcode
and address for each byte will be sent to the device.
This program will repeat forever.
Another, more efficient method of reading consecutive
addresses is called the ‘sequential read’ mode. This
involves sending the opcode and address for the first
byte to read, then continuing to provide clocks for the
next addresses. The device will automatically increment
the address. An example of the sequential read mode is
provided in the ‘3wseqr.asm’ file.
This program communicates to the serial EE in the
x16 mode, and ASSUMES THE USER HAS SET THE ORG PIN
ON THE DEVICE TO Vcc.
Timing is based on using the PIC16C54 in ‘XT’ mode
using a 4Mhz crystal. Clock speeds to the serial EE
will be approximately 50 kHz for this setup.
PIC16C54 to Serial EE Connections:
PIC16C54
——————
Serial EE
——————
Pin 10 (RB4) —> Chip Select
Pin 11 (RB5) —> Clock
Pin 12 (RB6) —> Data In
Pin 13 (RB7) —> Data Out
ORG = Vcc
;************************************************************
Register Assignments
;************************************************************
;
0003 status equ
0005 port_a equ
0006 port_b equ
000A eeprom equ
3h
5h
6h
; status register
; port 5 (port_a)
; port 6 (port b) comm lines to serial EE
; bit buffer
; address register
; stored data input reg.
; stored data output reg.
; transmit buffer
; bits transmitted so far
; bits to transmit
0ah
0ch
0dh
0eh
10h
11h
12h
13h
000C addr
000D datai
000E datao
0010 txbuf
0011 count
0012 bits
equ
equ
equ
equ
equ
equ
0013 bytcnt equ
; byte counter for read routine
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:10 1994 Page 2
Line
PC
Opcode
0052
0053
0054
0055
0056
0057
0058
0059
0060
0015 loops
0016 loops2 equ
0017 hbyte
0018 lbyte
equ
15h
16h
17h
18h
; delay loop counter
; delay loop counter
; high byte for input data
; low byte for input data
equ
equ
;************************************************************
Bit Assignments
;************************************************************
;
0007 di
0006 do
equ
equ
7
6
; eeprom input
; eeprom output
DS00560D-page 2
© 1994 Microchip Technology Inc.
8-100
Using the 93LC56 and 93LC66
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0007 datout equ
7
6
5
4
; data out line (port_b)
; data in line (port_b)
; clock line (port_b)
0006 datin
0005 sclk
equ
equ
0004 chpsel equ
;
; chip select line (port_b)
;*************************************************************
0000
org
01ffh
PWRUP
000h
01FF 0A33 begin
goto
org
goto
; set the reset vector
0000
0000 0A33
;
PWRUP
;**************************************************************
;
;
;
Start Bit Subroutine
this routine generates a start bit
(Chip select and DI high when clock goes high)
;**************************************************************
BSTART
0001 04C6
0002 0486
0003 04A6
0004 0000
bcf
bcf
bcf
nop
port_b,datin
port_b,chpsel ; low just to check operation
port_b,sclk ; make sure clock starts low too.
; set datain and chipselect lines
;
0005 0586
0006 05C6
0007 0000
0008 05A6
bsf
bsf
nop
bsf
port_b,chpsel ; set chip select line high
port_b,datin
; set data in line high
port_b,sclk
; set the clock line high to
; generate the start bit
0009 0000
000A 0000
000B 04A6
000C 0800
nop
nop
bcf
retlw
;
port_b,sclk
0
; set clock low again
;**************************************************************
;
;
BITIN routine reads one bit of data from the
serial EE device and stores it in ‘di’
;**************************************************************
BITIN
000D 05EA
000E 05A6
000F 0000
0010 07E6
0011 04EA
bsf
bsf
nop
btfss
bcf
eeprom,di
; assume input bit is high
port_b,sclk
; set clock line high
;
port_b,datout ; read the data bit
eeprom,di ; input bit was low
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:10 1994 Page 3
Line
PC
Opcode
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0012 04A6
0013 0800
bcf
port_b,sclk
0
; set clock line low
;
;
8
retlw
;****************************************************************
;
;
;
Receive data routine
This routine reads one byte of data from the part
into the ‘datai’ register.
;****************************************************************
RX
0014 006D
0015 0C08
0016 0031
0017 0403
0018 036D RXLP
0019 090D
001A 040D
001B 06EA
001C 050D
001D 02F1
001E 0A18
001F 0800
clrf
movlw
movwf
bcf
rlf
call
bcf
btfsc
bsf
decfsz count
goto
retlw
datai
.8
count
status,0
datai
; clear input buffer
; set # bits to 8
; make sure carry bit is low
; rotate the buffer left 1 bit
; read 1 bit
; assume the input bit was low
; check the bit
; set high if neccessary
; 8 bits done?
; no, do another
BITIN
datai,0
eeprom,di
datai,0
RXLP
0
© 1994 Microchip Technology Inc.
DS00560D-page 3
8-101
Using the 93LC56 and 93LC66
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
;
;*************************************************************
;
;
;
BITOUT routine
This routine takes one bit of data in ‘do’ and
transmits it to the serial EE device
;*************************************************************
BITOUT
0020 07CA
0021 0A24
0022 05C6
0023 0A25
btfss
goto
bsf
eeprom,do
bitlow
port_b,datin
clkout
; check state of data bit
; low, goto bitlow
; high, set datain high
; and clock it
goto
;
0024 04C6 bitlow
0025 05A6 clkout
0026 0000
bcf
bsf
port_b,datin
port_b,sclk
; output a logic low
; set clock line high
nop
0027 04A6
0028 0800
bcf
retlw
port_b,sclk
0
; return clock line low
;
;****************************************************************
;
;
;
Transmit Data Subroutine
This routine takes the byte of data stored in the
‘datao’ register and transmits it to the serial EE device.
;****************************************************************
TX
0029 0212
002A 0031
movf
movwf
;
bits,w
count
; set the number of bits to xmit
TXLP
002B 04CA
bcf
eeprom,do
; assume bit 7 is low
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:10 1994 Page 4
Line
PC
Opcode
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
002C 06F0
002D 05CA
002E 0920
002F 0370
0030 02F1
0031 0A2B
0032 0800
btfsc
bsf
call
rlf
decfsz count
goto
txbuf,7
eeprom,do
BITOUT
; is bit 7 clear?
; no, set data bit =1
; transmit 1 bit to serial EE
; rotate txbuf left
; all bits done?
; no, do another bit
; yes, jump out
txbuf
TXLP
0
retlw
;
;****************************************************************
;
;
;
;
POWER-UP ROUTINE
This is the program entry point, which in this case simply
sets the port_a I/O lines and directs control to the
read routine.
;*****************************************************************
PWRUP
;
0033 0C00
0034 0005
0035 0065
movlw
tris
clrf
b’00000000'
port_a
port_a
; set port_a as all output
; all lines low
0036 0C80
0037 0006
movlw
tris
b’10000000'
port_b
; set RB7 as input, rest output;
;
;
;
Fall through and do the read
;*********************************************************************
;
;
;
;
READ ROUTINE
This routine reads 8 consecutive addresses in
random mode starting at address 0. This is done in
x16 mode and will repeat forever.
;*********************************************************************
READ
;
0038 0C00
0039 002C
movlw
movwf
.0
addr
; set starting address to 00
;
DS00560D-page 4
© 1994 Microchip Technology Inc.
8-102
Using the 93LC56 and 93LC66
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
003A 0C08
003B 0033
movlw
movwf
.8
bytcnt
; set number of addresses to
; read as 8
;
; generate the start bit
; set # bits to 2
;
; get opcode (10b)
; into output buffer
; and transmit it
;
003C 0901 rbyte
003D 0C02
003E 0032
003F 0C80
0040 0030
0041 0929
0042 0C08
0043 0032
0044 020C
0045 0030
0046 0929
call
BSTART
.2
bits
b’10000000'
txbuf
TX
.8
bits
addr,w
txbuf
TX
movlw
movwf
movlw
movwf
call
movlw
movwf
movf
; set number of bits to 8
; get the address
; into the output buffer
; and transmit it
movwf
call
0047 0914
call
RX
; read the high byte
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:10 1994 Page 5
Line
PC
Opcode
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0048 020D
0049 0037
movf
movwf
datai,w
hbyte
; move input data to w
; xfer it to high byte
004A 0914
004B 020D
004C 0037
call
movf
movwf
RX
datai,w
hbyte
; read the low byte
; move input data to w
; xfer it to low byte
004D 0486
bcf
port_b,chpsel ; clear the chip select line
004E 02AC
004F 02F3
0050 0A3C
0051 0A38
incf
decfsz bytcnt
goto
goto
addr
; add 1 to the address
; have all bytes been read?
; no, read another byte
; yes, start over
rbyte
READ
0000 END
8
© 1994 Microchip Technology Inc.
DS00560D-page 5
8-103
Using the 93LC56 and 93LC66
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:06 1994 Page 1
Line
PC
Opcode
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
LIST P=16C54,c=132
;****************************************************************
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
3-Wire Byte Write Program (106 bytes)
This program demonstrates how to interface a
Microchip PIC16C54 to a 93LC56 or 93LC66 Serial EE
device. This program will execute the erase/write enable
command, write to 8 consecutive addresses, and then
execute the erase/write disable command. This
sequence will repeat forever.
After each byte is written, time must be given to the
device for it to complete the write cycle before
the next command can be sent. The easiest solution
is to consult the data book for the maximum write
cycle time and just wait that long before the next
command is sent. This program demonstrates that
solution.
Another, more efficient method of determining when the
write cycle is complete is called ‘data polling.’ This
method is demonstrated in the program “3wdpoll.”
This program communicates to the serial EE in the
x16 mode, and ASSUMES THE USER HAS SET THE ORG PIN
ON THE DEVICE TO Vcc.
Timing is based on using the PIC16C54 in ‘XT’ mode
using a 4Mhz crystal. Clock speeds to the serial EE
will be approximately 40 kHz for this setup.
PIC16C54 to Serial EE Connections:
PIC16C54
——————
Serial EE
——————
Pin 10 (RB4) —> Chip Select
Pin 11 (RB5) —> Clock
Pin 12 (RB6) —> Data In
Pin 13 (RB7) —> Data Out
ORG=Vcc
;************************************************************
Register Assignments
;************************************************************
;
0005 port_a equ
0006 port_b equ
000A eeprom equ
5h
6h
; port 5 (port_a)
; port 6 (port b) comm lines to serial EE
; bit buffer
0ah
0ch
0dh
0eh
10h
000C addr
000D datai
000E datao
0010 txbuf
equ
equ
equ
equ
; address register
; stored data input reg.
; stored data output reg.
; transmit buffer
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:06 1994 Page 2
Line
PC
Opcode
0052
0053
0054
0055
0056
0057
0058
0059
0060
0011 count
0012 bits
0013 bytcnt equ
0015 loops equ
0016 loops2 equ
equ
equ
11h
12h
13h
15h
16h
; bits transmitted so far
; bits to transmit
; byte counter for write routine
; delay loop counter
; delay loop counter
;
;************************************************************
Bit Assignments
;************************************************************
;
0007 di
equ
7
; eeprom input
DS00560D-page 6
© 1994 Microchip Technology Inc.
8-104
Using the 93LC56 and 93LC66
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0006 do
0007 datout equ
0006 datin
0005 sclk
0004 chpsel equ
;
equ
6
7
6
5
4
; eeprom output
; data out line (port_b)
; data in line (port_b)
; clock line (port_b)
equ
equ
; chip select line (port_b)
;*************************************************************
0000
org
goto
org
01ffh
PWRUP
000h
01FF 0A2F begin
; set the reset vector
0000
0000 0A2F
;
goto
PWRUP
;*************************************************************
;
;
;
;
DELAY ROUTINE
This routine takes the value in ‘loops’
and multiplies it times 1 millisecond to
determine delay time.
;*************************************************************
WAIT
;
0001 0C6E top
0002 0036
0003 0000 top2
0004 0000
0005 0000
0006 0000
0007 0000
0008 0000
0009 02F6
000A 0A03
movlw
movwf
nop
nop
nop
nop
nop
nop
.110
; timing adjustment variable
; sit and wait
loops2
decfsz loops2
goto top2
; inner loops complete?
; no, go again
;
; outer loops complete?
; no, go again
; yes, return from sub
000B 02F5
000C 0A01
000D 0800
;
decfsz loops
goto
retlw
top
0
;**************************************************************
;
;
;
Start Bit Subroutine
this routine generates a start bit
(Chip select and DI high when clock goes high)
;**************************************************************;
BSTART
000E 0C8F
movlw
b’10001111'
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:06 1994 Page 3
Line
PC
Opcode
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
000F 0006
tris
port_b
; set port b for output
; except for the data out line
; set datain and chipselect lines
8
0010 04C6
0011 0486
0012 04A6
0013 0000
bcf
bcf
bcf
nop
port_b,datin
port_b,chpsel ; low just to check operation
port_b,sclk ; make sure clock starts low too.
;
0014 0586
0015 05C6
0016 0000
0017 05A6
bsf
bsf
nop
bsf
port_b,chpsel ; set chip select line high
port_b,datin
; set data in line high
port_b,sclk
; set the clock line high to
; generate the start bit
0018 0000
0019 0000
001A 04A6
001B 0800
nop
nop
bcf
retlw
;
port_b,sclk
0
; set clock low again
;*************************************************************
;
;
;
BITOUT routine
This routine takes one bit of data in ‘do’ and
transmits it to the serial EE device
;*************************************************************
© 1994 Microchip Technology Inc.
DS00560D-page 7
8-105
Using the 93LC56 and 93LC66
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
BITOUT
001C 07CA
001D 0A20
001E 05C6
001F 0A21
btfss
goto
bsf
eeprom,do
bitlow
port_b,datin
clkout
; check state of data bit
; low, goto bitlow
; high, set datain high
; and clock it
goto
;
0020 04C6 bitlow
0021 05A6 clkout
0022 0000
bcf
bsf
nop
bcf
port_b,datin
port_b,sclk
; output a logic low
; set clock line high
0023 04A6
0024 0800
port_b,sclk
0
; return clock line low
retlw
;
;****************************************************************
;
;
;
Transmit Data Subroutine
This routine takes the byte of data stored in the
‘datao’ register and transmits it to the serial EE device.
;****************************************************************
TX
0025 0212
0026 0031
movf
movwf
;
bits,w
count
; set the number of bits to xmit
TXLP
0027 04CA
0028 06F0
0029 05CA
002A 091C
002B 0370
002C 02F1
002D 0A27
bcf
btfsc
bsf
call
rlf
decfsz count
goto TXLP
eeprom,do
txbuf,7
eeprom,do
BITOUT
; assume bit 7 is low
; is bit 7 clear?
; no, set data bit =1
; transmit 1 bit to serial EE
; rotate txbuf left
; all bits done?
txbuf
; no, do another bit
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:06 1994 Page 4
Line
PC
Opcode
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
002E 0800
retlw
0
; yes, jump out
;
;****************************************************************
;
;
;
;
POWER-UP ROUTINE
This is the program entry point, which in this case simply
sets the port_a I/O lines and directs control to the
erase/write enable routine.
;*****************************************************************
PWRUP
;
002F 0C00
0030 0005
0031 0065
movlw
tris
clrf
b’00000000'
port_a
port_a
; set port_a as all output
; all lines low
0032 0C80
0033 0006
movlw
tris
b’10000000'
port_b
; set RB7 as input, rest output;
;
;
;
Fall through and do erase/write enable
;****************************************************************
;
;
;
;
EWEN (Erase/Write ENable Routine)
this routine enables the dut for erasing and
writing. This must be done prior to any erase,write
eral,wral instructions.
;****************************************************************
EWEN
;
0034 090E
call
BSTART
; generate a start bit
;
; set # bits to 2
;
; get the opcode (00b)
; into the output buffer
; and transmit it
; set # bits to 8
0035 0C02
0036 0032
0037 0C00
0038 0030
0039 0925
003A 0C08
movlw
movwf
movlw
movwf
call
.2
bits
b’00000000'
txbuf
TX
movlw
.8
DS00560D-page 8
© 1994 Microchip Technology Inc.
8-106
Using the 93LC56 and 93LC66
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
003B 0032
003C 0CC0
movwf
movlw
bits
b’11000000'
;
; get opcode and address
(11XXXXXX)
;
003D 0030
003E 0925
003F 0486
0040 0000
movwf
call
bcf
txbuf
TX
; into output buffer
; and transmit it
port_b,chpsel ; set chip select line low
nop
;
;
;
Now continue on to the write command
;**************************************************************
;
;
;
;
;
Byte Write Routine
This routine writes an AA55h pattern into
8 consecutive addresses starting at address 00.
A delay of about 10ms is given after each byte
for the write cycle to complete.
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:06 1994 Page 5
Line
PC
Opcode
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
;
;
The write is done in the x16 mode: the user must
have the ORG pin tied to Vcc on the device
;****************************************************************
WRITE
;
0041 0C00
0042 002C
0043 0C08
0044 0033
movlw
movwf
movlw
movwf
.0
addr
.8
; set starting address to 00
;
; set number of bytes to write as 8
;
bytcnt
;
0045 090E topwr
call
BSTART
; generate the start bit
;
0046 0C02
0047 0032
0048 0C40
0049 0030
004A 0925
movlw
movwf
movlw
movwf
call
.2
bits
b’01000000'
txbuf
TX
; set # bits to 2 for the opcode
;
; get opcode (01b)
; into the transmit buffer
; and send it
;
004B 0C08
004C 0032
004D 020C
004E 0030
004F 0925
0050 0CAA
0051 0030
0052 0925
0053 0C55
0054 0030
0055 0925
movlw
movwf
movf
movwf
call
.8
bits
addr,w
txbuf
TX
; set # of bits to 8 for the
; address
; get address counter
; into output buffer
; and send it
movlw
movwf
call
b’10101010'
txbuf
TX
; get upper byte of data (AAh)
; into the transmit buffer
; and send it
movlw
movwf
call
b’01010101'
txbuf
TX
; get lower byte of data (55h)
; into transmit buffer
; and send it
8
;
0056 0486
bcf
port_b,chpsel ; clear the chip select line
; to initiate write cycle
;
0057 0C0A
0058 0035
0059 0901
movlw
movwf
call
.10
loops
WAIT
;
; set delay time to 10mS
; and wait
;
005A 02AC
005B 02F3
005C 0A45
incf
decfsz bytcnt
goto topwr
addr
; increment address counter
; all bytes written?
; no, do another
; yes, go on
;
;
;
Now continue on to the erase/write disable command
;****************************************************************
;
;
;
EWDS (Erase/Write Disable Routine)
This routine executes the erase/write disable command
which prevents the contents of the array from being
© 1994 Microchip Technology Inc.
DS00560D-page 9
8-107
Using the 93LC56 and 93LC66
0253
0254
0255
;
;
written to.
;****************************************************************
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:06 1994 Page 6
Line
PC
Opcode
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
EWDS
;
005D 090E
call
BSTART
; generate a start bit
;
005E 0C02
005F 0032
0060 0C00
0061 0030
0062 0925
0063 0C08
0064 0032
0065 0C00
movlw
movwf
movlw
movwf
call
movlw
movwf
movlw
.2
bits
b’00000000'
txbuf
TX
.8
bits
b’00000000'
; set # bits to 2
;
; get the opcode (00b)
; into the output buffer
; and transmit it
; set # bits to 8
;
; get opcode and address
;
(00XXXXXX)
0066 0030
0067 0925
0068 0486
0069 0000
006A 0A34
movwf
call
bcf
nop
goto
txbuf
TX
; into output buffer
; and transmit it
port_b,chpsel ; set chip select line low
EWEN ; start all over
;
0000 END
DS00560D-page 10
© 1994 Microchip Technology Inc.
8-108
Using the 93LC56 and 93LC66
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:00 1994 Page 1
Line
PC
Opcode
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
LIST P=16C54,c=132
;****************************************************************
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
3-Wire Byte Write with Data Poll Program (107 bytes)
This program demonstrates how to interface a
Microchip PIC16C54 to a 93LC56 or 93LC66 Serial EE
device. This program will execute the erase/write enable
command, write to 8 consecutive addresses, and then
use the ‘data polling’ method to determine when the
write cycle is complete. The program then executes
the erase/write disable command. This sequence will
repeat forever.
When writing to a 3-wire serial EE device, the
internally timed write cycle will begin after
the opcode, address and data are sent to the
device. There are two ways to make sure that the
cycle is complete before you send it another command.
The simplest method is to simply wait for the maximum
write cycle time, which can be obtained from the data book.
A more efficient method is “Data polling.” This is
done by toggling the chip select line low and then
back high after the opcode, address and data are sent.
The chip select line must be low for at least 250ns
before bringing it high again. The device will pull
the data out line low at that point, and set it high
when the write cycle is complete. The user can then check
or “poll” the dataout line until it goes high before
sending the next command.
As an option, the user can connect a LED to pin 18
on the PIC16C54 (use about a 1K resistor in series) as a
timeout indicator. This LED will come on if the
data polling is unsuccessful and the device being
programmed does not respond. This can be tested by
simply running the program with no part in the socket.
This program communicates to the serial EE in the
x16 mode, and ASSUMES THE USER HAS SET THE ORG PIN
ON THE DEVICE TO Vcc.
Timing is based on using the PIC16C54 in ‘XT’ mode
using a 4Mhz crystal. Clock speeds to the serial EE
will be approximately 50 kHz for this setup.
8
PIC16C54 to Serial EE Connections:
PIC16C54
——————
Serial EE
——————
Pin 10 (RB4) —> Chip Select
Pin 11 (RB5) —> Clock
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:00 1994 Page 2
Line
PC
Opcode
0052
0053
0054
0055
0056
0057
0058
0059
0060
;
;
;
;
Pin 12 (RB6) —> Data In
Pin 13 (RB7) —> Data Out
ORG=Vcc
;************************************************************
Register Assignments
;************************************************************
;
0005 port_a equ
0006 port_b equ
5h
6h
; port 5 (port_a)
; port 6 (port b) used comm lines to serial EE
© 1994 Microchip Technology Inc.
DS00560D-page 11
8-109
Using the 93LC56 and 93LC66
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
000A eeprom equ
0ah
0ch
0dh
0eh
10h
11h
12h
13h
15h
16h
; bit buffer
; address register
000C addr
000D datai
000E datao
0010 txbuf
0011 count
0012 bits
equ
equ
equ
equ
equ
equ
; stored data input reg.
; stored data output reg.
; transmit buffer
; bits transmitted so far
; bits to transmit
; byte counter for write routine
; delay loop counter
; delay loop counter
0013 bytcnt equ
0015 loops equ
0016 loops2 equ
;************************************************************
Bit Assignments
;************************************************************
;
0007 di
0006 do
equ
equ
7
6
7
6
5
4
1
; eeprom input
; eeprom output
0007 datout equ
; data out line (port_b)
; data in line (port_b)
; clock line (port_b)
; chip select line (port_b)
; write cycle timeout warning (port_a)
0006 datin
0005 sclk
equ
equ
0004 chpsel equ
0001 timeout equ
;
;*************************************************************
0000
org
01ffh
PWRUP
000h
01FF 0A26 begin
goto
org
goto
; set the reset vector
0000
0000 0A26
;
PWRUP
;*************************************************************
;
;
;
DATA POLL DELAY ROUTINE
This routine delays 100 us is
used for delay between polls
;*************************************************************
dpdelay
;
0001 0C19
0002 0036
0003 0000 top
0004 02F6
0005 0A03
movlw
movwf
nop
decfsz loops2
goto
.25
loops2
; timing adjustment variable
; loops complete?
; no, go again
;
top
0006 0800
;
retlw
0
; yes, return from sub
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:00 1994 Page 3
Line
PC
Opcode
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
;**************************************************************
;
;
;
Start Bit Subroutine
this routine generates a start bit
(Chip select and DI high when clock goes high)
;**************************************************************;
BSTART
0007 04C6
0008 0486
0009 04A6
000A 0000
bcf
bcf
bcf
nop
port_b,datin
port_b,chpsel ; low just to check operation
port_b,sclk ; make sure clock starts low too.
; set datain and chipselect lines
;
000B 0586
000C 05C6
000D 0000
000E 05A6
bsf
bsf
nop
bsf
port_b,chpsel ; set chip select line high
port_b,datin
; set data in line high
port_b,sclk
; set the clock line high to
; generate the start bit
000F 0000
0010 0000
0011 04A6
0012 0800
nop
nop
bcf
retlw
;
port_b,sclk
0
; set clock low again
;*************************************************************
DS00560D-page 12
© 1994 Microchip Technology Inc.
8-110
Using the 93LC56 and 93LC66
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
;
;
;
BITOUT routine
This routine takes one bit of data in ‘do’ and
transmits it to the serial EE device
;*************************************************************
BITOUT
0013 07CA
0014 0A17
0015 05C6
0016 0A18
btfss
goto
bsf
eeprom,do
bitlow
port_b,datin
clkout
; check state of data bit
; low, goto bitlow
; high, set datain high
; and clock it
goto
;
0017 04C6 bitlow
0018 05A6 clkout
0019 0000
bcf
bsf
port_b,datin
port_b,sclk
; output a logic low
; set clock line high
nop
001A 04A6
001B 0800
bcf
retlw
port_b,sclk
0
; return clock line low
;
;****************************************************************
;
;
;
Transmit Data Subroutine
This routine takes the byte of data stored in the
‘datao’ register and transmits it to the serial EE device.
;****************************************************************
TX
001C 0212
001D 0031
movf
movwf
;
bits,w
count
; set the number of bits to xmit
TXLP
001E 04CA
001F 06F0
0020 05CA
bcf
btfsc
bsf
eeprom,do
txbuf,7
eeprom,do
; assume bit 7 is low
; is bit 7 clear?
; no, set data bit =1
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:00 1994 Page 4
Line
PC
Opcode
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0021 0913
0022 0370
0023 02F1
0024 0A1E
0025 0800
call
rlf
decfsz count
goto
retlw
BITOUT
txbuf
; transmit 1 bit to serial EE
; rotate txbuf left
; all bits done?
; no, do another bit
; yes, jump out
TXLP
0
;
;****************************************************************
;
;
;
;
POWER-UP ROUTINE
This is the program entry point, which in this case simply
sets the port_a I/O lines and directs control to the
erase/write enable routine.
;*****************************************************************
PWRUP
;
0026 0C00
0027 0005
0028 0065
movlw
tris
clrf
b’00000000'
port_a
port_a
8
; set port_a as all output
; all lines low
0029 0C80
002A 0006
movlw
tris
b’10000000'
port_b
; set RB7 as input, rest output;
;
;
;
Fall through and do erase/write enable
;****************************************************************
;
;
;
;
EWEN (Erase/Write ENable Routine)
this routine enables the dut for erasing and
writing. This must be done prior to any erase,write
eral,wral instructions.
;****************************************************************
EWEN
;
002B 0907
call
BSTART
; generate a start bit
;
; set # bits to 2
;
002C 0C02
002D 0032
movlw
movwf
.2
bits
© 1994 Microchip Technology Inc.
DS00560D-page 13
8-111
Using the 93LC56 and 93LC66
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
002E 0C00
002F 0030
0030 091C
0031 0C08
0032 0032
0033 0CC0
movlw
movwf
call
movlw
movwf
movlw
b’00000000'
txbuf
TX
.8
bits
b’11000000'
; get the opcode (00b)
; into the output buffer
; and transmit it
; set # bits to 8
;
; get opcode and address
;
(11XXXXXX)
0034 0030
0035 091C
0036 0486
0037 0000
movwf
call
bcf
txbuf
TX
; into output buffer
; and transmit it
port_b,chpsel ; set chip select line low
nop
;
;
;
Now continue on to the write command
;**************************************************************
WRITE
;
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:00 1994 Page 5
Line
PC
Opcode
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
;
;
;
;
;
;
;
;
;
This routine writes a AA55h pattern into
8 consecutive addresses starting at address 00.
It will then ‘poll’ the data out line to determine
when the write cycle is complete. If the cycle has
not completed within 20 ms, then it will continue
anyway and turn the timeout fail LED on.
The write is done in the x16 mode: the user must
have the ORG pin tied to Vcc on the device. This
program will repeat forever.
;****************************************************************
WRITE
;
0038 0C00
0039 002C
003A 0C08
003B 0033
movlw
movwf
movlw
movwf
.0
addr
.8
; set starting address to 00
;
; set number of bytes to write as 8
;
bytcnt
;
003C 0907 topwr
call
BSTART
; generate the start bit
;
003D 0C02
003E 0032
003F 0C40
0040 0030
0041 091C
movlw
movwf
movlw
movwf
call
.2
bits
b’01000000'
txbuf
TX
; set # bits to 2 for the opcode
;
; get opcode (01b)
; into the transmit buffer
; and send it
;
0042 0C08
0043 0032
0044 020C
0045 0030
0046 091C
0047 0CAA
0048 0030
0049 091C
004A 0C55
004B 0030
004C 091C
movlw
movwf
movf
movwf
call
.8
bits
addr,w
txbuf
TX
; set # of bits to 8 for the
; address
; get address counter
; into output buffer
; and send it
movlw
movwf
call
b’10101010'
txbuf
TX
; get first half of data (AAh)
; into the transmit buffer
; and send it
movlw
movwf
call
b’01010101'
txbuf
TX
; get second half of data (55h)
; into transmit buffer
; and send it
;
004D 0486
bcf
port_b,chpsel ; clear the chip select line
; to initiate write cycle
004E 0000
004F 0586
nop
bsf
port_b,chpsel ; set the chip sel line high
; to begin data polling
0050 0CC8
0051 0035
movlw
movwf
.200
loops
dpdelay
;
; poll 100 times before timeout(about 20ms)
; wait 100us
0052 0901 polltop call
0053 06E6
0054 0A59
0055 02F5
btfsc
goto
decfsz loops
port_b,datout ; is the data out line high?
okpoll
; yes-cycle complete: do another
; has it timed out?
DS00560D-page 14
© 1994 Microchip Technology Inc.
8-112
Using the 93LC56 and 93LC66
0253
0254
0255
0056 0A52
0057 0525
0058 0A5A
goto
bsf
goto
polltop
; no, check again
port_a,timeout; yes, set timeout LED and go on
badpoll
;
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:00 1994 Page 6
Line
PC
Opcode
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0059 0425 okpoll
005A 0486 badpoll bcf
005B 02AC
005C 02F3
005D 0A3C
bcf
port_a,timeout; clear the timeout LED
port_b,chpsel ; chip sel line back low
incf
decfsz bytcnt
goto topwr
addr
; increment address counter
; all bytes written?
; no, do another
; yes, go on
;
;
;
Now continue on to the erase/write disable command
;****************************************************************
;
;
;
;
;
EWDS (Erase/Write Disable Routine)
This routine executes the erase/write disable command
which prevents the contents of the array from being
written to.
;****************************************************************
EWDS
;
005E 0907
call
BSTART
; generate a start bit
;
005F 0C02
0060 0032
0061 0C00
0062 0030
0063 091C
0064 0C08
0065 0032
0066 0C00
movlw
movwf
movlw
movwf
call
movlw
movwf
movlw
.2
bits
; set # bits to 2
;
b’00000000'
txbuf
TX
.8
bits
; get the opcode (00b)
; into the output buffer
; and transmit it
; set # bits to 8
;
b’00000000'
; get opcode and address
;
(00XXXXXX)
0067 0030
0068 091C
0069 0486
006A 0000
006B 0A2B
movwf
call
bcf
nop
goto
txbuf
TX
; into output buffer
; and transmit it
port_b,chpsel ; set chip select line low
EWEN ; start all over
;
;
0000 END
8
© 1994 Microchip Technology Inc.
DS00560D-page 15
8-113
Using the 93LC56 and 93LC66
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:20 1994 Page 1
Line
PC
Opcode
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
LIST P=16C54,c=132
;****************************************************************
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
3-Wire Sequential Read Program (93 bytes)
This program demonstrates how to interface a
Microchip PIC16C54 to a 93LC56 or 93LC66 Serial EE
device. This program will read 8 consecutive addresses
in the ‘sequential read’ mode. This means that the opcode
and address are sent for the first address only. After
the first address is read, the Chip Select line is left
high and clocks for the remaining 7 bytes are sent to the
device. The device will automatically increment the address
pointer in this mode, allowing the user to read as many
consecutive addresses as needed. This program will repeat
forever.
This program communicates to the serial EE in the
x16 mode, and ASSUMES THE USER HAS SET THE ORG PIN
ON THE DEVICE TO Vcc.
Timing is based on using the PIC16C54 in ‘XT’ mode
using a 4MHz crystal. Clock speeds to the serial EE
will be approximately 50 kHz for this setup.
PIC16C54 to Serial EE Connections:
PIC16C54
——————
Serial EE
——————
Pin 10 (RB4) —> Chip Select
Pin 11 (RB5) —> Clock
Pin 12 (RB6) —> Data In
Pin 13 (RB7) —> Data Out
ORG = Vcc
;************************************************************
Register Assignments
;************************************************************
;
0003 status equ
0005 port_a equ
0006 port_b equ
000A eeprom equ
3h
5h
6h
; status register
; port 5 (port_a)
; port 6 (port b) used comm lines to serial EE
; bit buffer
; address register
; stored data input reg.
; stored data output reg.
; transmit buffer
; bits transmitted so far
; bits to transmit
; byte counter for read routine
; delay loop counter
; delay loop counter
0ah
0ch
0dh
0eh
10h
11h
12h
13h
15h
16h
17h
000C addr
000D datai
000E datao
0010 txbuf
0011 count
0012 bits
equ
equ
equ
equ
equ
equ
0013 bytcnt equ
0015 loops equ
0016 loops2 equ
0017 hbyte equ
; high byte for input data
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:20 1994 Page 2
Line
PC
Opcode
0052
0053
0054
0055
0056
0057
0058
0059
0060
0018 lbyte
equ
18h
; low byte for input data
;************************************************************
Bit Assignments
;************************************************************
;
0007 di
0006 do
0007 datout equ
0006 datin
0005 sclk
equ
equ
7
6
7
6
5
; eeprom input
; eeprom output
; data out line (port_b)
; data in line (port_b)
; clock line (port_b)
equ
equ
DS00560D-page 16
© 1994 Microchip Technology Inc.
8-114
Using the 93LC56 and 93LC66
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0004 chpsel equ
;
4
; chip select line (port_b)
;*************************************************************
0000
org
01ffh
PWRUP
000h
01FF 0A40 begin
goto
org
goto
; set the reset vector
0000
0000 0A40
;
PWRUP
;*************************************************************
;
;
;
;
DELAY ROUTINE
This routine takes the value in ‘loops’
and multiplies it times 1 millisecond to
determine delay time.
;*************************************************************
WAIT
;
0001 0C6E top
0002 0036
0003 0000 top2
0004 0000
movlw
movwf
nop
.110
; timing adjustment variable
; sit and wait
loops2
nop
0005 0000
nop
0006 0000
nop
0007 0000
nop
0008 0000
nop
0009 02F6
000A 0A03
decfsz loops2
goto top2
; inner loops complete?
; no, go again
;
; outer loops complete?
; no, go again
; yes, return from sub
000B 02F5
000C 0A01
000D 0800
;
decfsz loops
goto
retlw
top
0
;**************************************************************
;
;
;
Start Bit Subroutine
this routine generates a start bit
(Chip select and DI high when clock goes high)
;**************************************************************
BSTART
000E 04C6
000F 0486
0010 04A6
0011 0000
bcf
bcf
bcf
nop
port_b,datin
port_b,chpsel ; low just to check operation
port_b,sclk ; make sure clock starts low too.
; set datain and chipselect lines
;
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:20 1994 Page 3
Line
PC
Opcode
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0012 0586
0013 05C6
0014 0000
0015 05A6
bsf
bsf
nop
bsf
port_b,chpsel ; set chip select line high
port_b,datin
; set data in line high
8
port_b,sclk
; set the clock line high to
; generate the start bit
0016 0000
0017 0000
0018 04A6
0019 0800
nop
nop
bcf
retlw
;
port_b,sclk
0
; set clock low again
;**************************************************************
;
;
BITIN routine reads one bit of data from the
serial EE device and stores it in ‘di’
;**************************************************************
BITIN
001A 05EA
001B 05A6
001C 0000
001D 07E6
001E 04EA
001F 04A6
bsf
bsf
nop
btfss
bcf
eeprom,di
; assume input bit is high
port_b,sclk
; set clock line high
;
port_b,datout ; read the data bit
eeprom,di
; input bit was low
bcf
port_b,sclk
; set clock line low
;
© 1994 Microchip Technology Inc.
DS00560D-page 17
8-115
Using the 93LC56 and 93LC66
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0020 0800
retlw
0
;
;****************************************************************
;
;
;
Receive data routine
This routine reads one byte of data from the part
into the ‘datai’ register.
;****************************************************************
RX
0021 006D
0022 0C08
0023 0031
0024 0403
0025 036D RXLP
0026 091A
0027 040D
0028 06EA
0029 050D
002A 02F1
002B 0A25
002C 0800
;
clrf
movlw
movwf
bcf
rlf
call
bcf
btfsc
bsf
decfsz count
goto
retlw
datai
.8
count
status,0
datai
; clear input buffer
; set # bits to 8
; make sure carry bit is low
; rotate the buffer left 1 bit
; read 1 bit
; assume the input bit was low
; check the bit
; set high if necessary
; 8 bits done?
; no, do another
BITIN
datai,0
eeprom,di
datai,0
RXLP
0
;*************************************************************
;
;
;
BITOUT routine
This routine takes one bit of data in ‘do’ and
transmits it to the serial EE device
;*************************************************************
BITOUT
002D 07CA
002E 0A31
btfss
goto
eeprom,do
bitlow
; check state of data bit
; low, goto bitlow
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:20 1994 Page 4
Line
PC
Opcode
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
002F 05C6
0030 0A32
bsf
goto
port_b,datin
clkout
; high, set datain high
; and clock it
;
; output a logic low
; set clock line high
0031 04C6 bitlow
0032 05A6 clkout
0033 0000
0034 04A6
0035 0800
bcf
bsf
nop
bcf
port_b,datin
port_b,sclk
port_b,sclk
0
; return clock line low
retlw
;
;****************************************************************
;
;
;
Transmit Data Subroutine
This routine takes the byte of data stored in the
‘datao’ register and transmits it to the serial EE device.
;****************************************************************
TX
0036 0212
0037 0031
movf
movwf
;
bits,w
count
; set the number of bits to xmit
TXLP
0038 04CA
0039 06F0
003A 05CA
003B 092D
003C 0370
003D 02F1
003E 0A38
003F 0800
bcf
btfsc
bsf
call
rlf
decfsz count
eeprom,do
txbuf,7
eeprom,do
BITOUT
; assume bit 7 is low
; is bit 7 clear?
; no, set data bit =1
; transmit 1 bit to serial EE
; rotate txbuf left
; all bits done?
txbuf
goto
retlw
TXLP
0
; no, do another bit
; yes, jump out
;
;****************************************************************
;
;
;
;
POWER-UP ROUTINE
This is the program entry point, which in this case simply
sets the port_a I/O lines and directs control to the
erase/write enable routine.
;*****************************************************************
PWRUP
DS00560D-page 18
© 1994 Microchip Technology Inc.
8-116
Using the 93LC56 and 93LC66
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
;
0040 0C11
0041 0005
0042 0065
0043 0C80
0044 0006
movlw
tris
clrf
movlw
tris
b’00010001'
port_a
port_a
b’10000000'
port_b
; set RA0 as input, rest output
; all lines low
; set RB7 as input, rest output;
;
;
;
Fall through and do the read
;*********************************************************************
;
;
;
;
READ ROUTINE (Sequential read mode)
This routine reads 8 consecutive addresses in
sequential mode starting at address 0. This
program will repeat forever
;*********************************************************************
READ
16c5x/7x Cross-Assembler V4.12 Released Mon Jun 06 10:49:20 1994 Page 5
Line
PC
Opcode
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
;
0045 0C00
0046 002C
0047 0C08
0048 0033
movlw
movwf
movlw
movwf
.0
addr
.8
; set starting address to 00
;
; set number of addresses to
; read as 8
bytcnt
;
0049 090E
004A 0C02
004B 0032
004C 0C80
004D 0030
004E 0936
004F 0C08
0050 0032
0051 020C
0052 0030
0053 0936
call
BSTART
.2
bits
b’10000000'
txbuf
TX
.8
bits
addr,w
txbuf
TX
; generate the start bit
; set # bits to 2
;
; get opcode (10b)
; into output buffer
; and transmit it
;
; set number of bits to 8
; get the address
; into the output buffer
; and transmit it
movlw
movwf
movlw
movwf
call
movlw
movwf
movf
movwf
call
0054 0921 rbyte
0055 020D
call
movf
movwf
RX
datai,w
hbyte
; read the high byte
; move input data to w
; xfer it to high byte
0056 0037
0057 0921
0058 020D
0059 0037
call
movf
movwf
RX
datai,w
hbyte
; read the low byte
; move input data to w
; xfer it to low byte
005A 02AC
005B 02F3
005C 0A54
incf
decfsz bytcnt
goto
addr
; add 1 to the address
; have all bytes been read?
; no, read another byte
8
rbyte
005D 0486
005E 0A45
0000 END
bcf
goto
port_b,chpsel ; yes,clear the chip select line
READ ; and start over
© 1994 Microchip Technology Inc.
DS00560D-page 19
8-117
Using the 93LC56 and 93LC66
NOTES:
DS00560D-page 20
© 1994 Microchip Technology Inc.
8-118
®
Note the following details of the code protection feature on PICmicro MCUs.
•
•
The PICmicro family meets the specifications contained in the Microchip Data Sheet.
Microchip believes that its family of PICmicro microcontrollers is one of the most secure products of its kind on the market today,
when used in the intended manner and under normal conditions.
•
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowl-
edge, require using the PICmicro microcontroller in a manner outside the operating specifications contained in the data sheet.
The person doing so may be engaged in theft of intellectual property.
•
•
Microchip is willing to work with the customer who is concerned about the integrity of their code.
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable”.
•
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of
our product.
If you have any further questions about this matter, please contact the local sales office nearest to you.
Information contained in this publication regarding device
applications and the like is intended through suggestion only
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
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’s products as critical com-
ponents in life support systems is not authorized except with
express written approval by Microchip. No licenses are con-
veyed, implicitly or otherwise, under any intellectual property
rights.
Trademarks
The Microchip name and logo, the Microchip logo, FilterLab,
KEELOQ, microID, MPLAB, PIC, PICmicro, PICMASTER,
PICSTART, PRO MATE, SEEVAL and The Embedded Control
Solutions Company are registered trademarks of Microchip Tech-
nology Incorporated in the U.S.A. and other countries.
dsPIC, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB,
In-Circuit Serial Programming, ICSP, ICEPIC, microPort,
Migratable Memory, MPASM, MPLIB, MPLINK, MPSIM,
MXDEV, PICC, PICDEM, PICDEM.net, rfPIC, Select Mode
and Total Endurance are trademarks of Microchip Technology
Incorporated in the U.S.A.
Serialized Quick Turn Programming (SQTP) is a service mark
of Microchip Technology Incorporated in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
© 2002, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
Microchip received QS-9000 quality system
certification for its worldwide headquarters,
design and wafer fabrication facilities in
Chandler and Tempe, Arizona in July 1999. The
Company’s quality system processes and
procedures are QS-9000 compliant for its
PICmicro® 8-bit MCUs, KEELOQ® code hopping
devices, Serial EEPROMs and microperipheral
products. In addition, Microchip’s quality
system for the design and manufacture of
development systems is ISO 9001 certified.
2002 Microchip Technology Inc.
M
WORLDWIDE SALES AND SERVICE
Japan
AMERICAS
ASIA/PACIFIC
Microchip Technology Japan K.K.
Benex S-1 6F
3-18-20, Shinyokohama
Kohoku-Ku, Yokohama-shi
Kanagawa, 222-0033, Japan
Tel: 81-45-471- 6166 Fax: 81-45-471-6122
Corporate Office
Australia
2355 West Chandler Blvd.
Microchip Technology Australia Pty Ltd
Suite 22, 41 Rawson Street
Epping 2121, NSW
Chandler, AZ 85224-6199
Tel: 480-792-7200 Fax: 480-792-7277
Technical Support: 480-792-7627
Web Address: http://www.microchip.com
Australia
Tel: 61-2-9868-6733 Fax: 61-2-9868-6755
Korea
Rocky Mountain
China - Beijing
Microchip Technology Korea
168-1, Youngbo Bldg. 3 Floor
Samsung-Dong, Kangnam-Ku
Seoul, Korea 135-882
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7966 Fax: 480-792-7456
Microchip Technology Consulting (Shanghai)
Co., Ltd., Beijing Liaison Office
Unit 915
Bei Hai Wan Tai Bldg.
Atlanta
500 Sugar Mill Road, Suite 200B
Atlanta, GA 30350
Tel: 82-2-554-7200 Fax: 82-2-558-5934
No. 6 Chaoyangmen Beidajie
Beijing, 100027, No. China
Tel: 86-10-85282100 Fax: 86-10-85282104
Singapore
Microchip Technology Singapore Pte Ltd.
200 Middle Road
#07-02 Prime Centre
Singapore, 188980
Tel: 65-334-8870 Fax: 65-334-8850
Taiwan
Microchip Technology Taiwan
11F-3, No. 207
Tung Hua North Road
Taipei, 105, Taiwan
Tel: 770-640-0034 Fax: 770-640-0307
China - Chengdu
Boston
Microchip Technology Consulting (Shanghai)
Co., Ltd., Chengdu Liaison Office
Rm. 2401, 24th Floor,
Ming Xing Financial Tower
No. 88 TIDU Street
Chengdu 610016, China
Tel: 86-28-6766200 Fax: 86-28-6766599
China - Fuzhou
Microchip Technology Consulting (Shanghai)
Co., Ltd., Fuzhou Liaison Office
Unit 28F, World Trade Plaza
No. 71 Wusi Road
Fuzhou 350001, China
Tel: 86-591-7503506 Fax: 86-591-7503521
China - Shanghai
Microchip Technology Consulting (Shanghai)
Co., Ltd.
Room 701, Bldg. B
Far East International Plaza
No. 317 Xian Xia Road
Shanghai, 200051
Tel: 86-21-6275-5700 Fax: 86-21-6275-5060
China - Shenzhen
Microchip Technology Consulting (Shanghai)
Co., Ltd., Shenzhen Liaison Office
Rm. 1315, 13/F, Shenzhen Kerry Centre,
Renminnan Lu
Shenzhen 518001, China
Tel: 86-755-2350361 Fax: 86-755-2366086
2 Lan Drive, Suite 120
Westford, MA 01886
Tel: 978-692-3848 Fax: 978-692-3821
Chicago
333 Pierce Road, Suite 180
Itasca, IL 60143
Tel: 630-285-0071 Fax: 630-285-0075
Dallas
4570 Westgrove Drive, Suite 160
Addison, TX 75001
Tel: 972-818-7423 Fax: 972-818-2924
Tel: 886-2-2717-7175 Fax: 886-2-2545-0139
EUROPE
Denmark
Microchip Technology Nordic ApS
Regus Business Centre
Lautrup hoj 1-3
Ballerup DK-2750 Denmark
Tel: 45 4420 9895 Fax: 45 4420 9910
Detroit
Tri-Atria Office Building
32255 Northwestern Highway, Suite 190
Farmington Hills, MI 48334
Tel: 248-538-2250 Fax: 248-538-2260
Kokomo
France
2767 S. Albright Road
Kokomo, Indiana 46902
Tel: 765-864-8360 Fax: 765-864-8387
Los Angeles
Microchip Technology SARL
Parc d’Activite du Moulin de Massy
43 Rue du Saule Trapu
Batiment A - ler Etage
91300 Massy, France
Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79
18201 Von Karman, Suite 1090
Irvine, CA 92612
Tel: 949-263-1888 Fax: 949-263-1338
Germany
New York
150 Motor Parkway, Suite 202
Hauppauge, NY 11788
Microchip Technology GmbH
Gustav-Heinemann Ring 125
D-81739 Munich, Germany
Tel: 49-89-627-144 0 Fax: 49-89-627-144-44
Tel: 631-273-5305 Fax: 631-273-5335
San Jose
Hong Kong
Italy
Microchip Technology Inc.
2107 North First Street, Suite 590
San Jose, CA 95131
Microchip Technology Hongkong Ltd.
Unit 901-6, Tower 2, Metroplaza
223 Hing Fong Road
Kwai Fong, N.T., Hong Kong
Tel: 852-2401-1200 Fax: 852-2401-3431
Microchip Technology SRL
Centro Direzionale Colleoni
Palazzo Taurus 1 V. Le Colleoni 1
20041 Agrate Brianza
Tel: 408-436-7950 Fax: 408-436-7955
Toronto
Milan, Italy
Tel: 39-039-65791-1 Fax: 39-039-6899883
6285 Northam Drive, Suite 108
Mississauga, Ontario L4V 1X5, Canada
Tel: 905-673-0699 Fax: 905-673-6509
India
Microchip Technology Inc.
India Liaison Office
United Kingdom
Arizona Microchip Technology Ltd.
505 Eskdale Road
Winnersh Triangle
Wokingham
Divyasree Chambers
1 Floor, Wing A (A3/A4)
No. 11, O’Shaugnessey Road
Bangalore, 560 025, India
Tel: 91-80-2290061 Fax: 91-80-2290062
Berkshire, England RG41 5TU
Tel: 44 118 921 5869 Fax: 44-118 921-5820
01/18/02
2002 Microchip Technology Inc.
93LC56CT-I/STG 相关器件
型号 | 制造商 | 描述 | 价格 | 文档 |
93LC56CTE/MS | MICROCHIP | 2K Microwire Compatible Serial EEPROM | 获取价格 | |
93LC56CTE/MSG | MICROCHIP | 2K Microwire Compatible Serial EEPROM | 获取价格 | |
93LC56CTE/OT | MICROCHIP | 2K Microwire Compatible Serial EEPROM | 获取价格 | |
93LC56CTE/OTG | MICROCHIP | 2K Microwire Compatible Serial EEPROM | 获取价格 | |
93LC56CTE/P | MICROCHIP | 2K Microwire Compatible Serial EEPROM | 获取价格 | |
93LC56CTE/PG | MICROCHIP | 2K Microwire Compatible Serial EEPROM | 获取价格 | |
93LC56CTE/SN | MICROCHIP | 2K Microwire Compatible Serial EEPROM | 获取价格 | |
93LC56CTE/SNG | MICROCHIP | 2K Microwire Compatible Serial EEPROM | 获取价格 | |
93LC56CTE/ST | MICROCHIP | 2K Microwire Compatible Serial EEPROM | 获取价格 | |
93LC56CTE/STG | MICROCHIP | 2K Microwire Compatible Serial EEPROM | 获取价格 |
93LC56CT-I/STG 相关文章
- 2024-09-20
- 5
- 2024-09-20
- 8
- 2024-09-20
- 8
- 2024-09-20
- 6