English
Language : 

AN560 Datasheet, PDF (8/22 Pages) Microchip Technology – Lowpower 3-wire non-volatile memories
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
001C
001D
001E
001F
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
002A
002B
002C
002D
07CA
0A20
05C6
0A21
04C6
05A6
0000
04A6
0800
0212
0031
04CA
06F0
05CA
091C
0370
02F1
0A27
BITOUT
btfss eeprom,do
; check state of data bit
goto bitlow
; low, goto bitlow
bsf
port_b,datin ; high, set datain high
goto clkout
; and clock it
;
bitlow bcf
port_b,datin ; output a logic low
clkout bsf
port_b,sclk ; set clock line high
nop
bcf
port_b,sclk ; return clock line low
retlw 0
;
;****************************************************************
;
Transmit Data Subroutine
;
This routine takes the byte of data stored in the
;
‘datao’ register and transmits it to the serial EE device.
;****************************************************************
TX
movf bits,w
; set the number of bits to xmit
movwf count
;
TXLP
bcf
eeprom,do
; assume bit 7 is low
btfsc txbuf,7
; is bit 7 clear?
bsf
eeprom,do
; no, set data bit =1
call BITOUT
; transmit 1 bit to serial EE
rlf
txbuf
; rotate txbuf left
decfsz count
; all bits done?
goto TXLP
; 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
002F
0030
0031
0800
0C00
0005
0065
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
;
movlw b’00000000'
tris port_a
; set port_a as all output
clrf port_a
; all lines low
0032
0033
0034
0035
0036
0037
0038
0039
003A
0C80
0006
090E
0C02
0032
0C00
0030
0925
0C08
movlw b’10000000'
tris 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
;
call BSTART
; generate a start bit
;
movlw .2
; set # bits to 2
movwf bits
;
movlw b’00000000' ; get the opcode (00b)
movwf txbuf
; into the output buffer
call TX
; and transmit it
movlw .8
; set # bits to 8
DS00560D-page 8
8-106
© 1994 Microchip Technology Inc.