PIC单片机的读写93C46程序

pic单片机的读写93c46程序
; this route is used for 93c46 (configue as
; 16 bits organizatio) read & write route
ra equ 5
rb equ 6
bit-count equ
data_hi equ 10h ; hi half of words
data_lo equ 11h ; lo half of words
rom_ad equ 12h ; the address of 93c46
temr equ 13h ;
bit_count equ 14h
;
cm_ewen equ 30h
cm_ewds equ 0h
;ra
cs equ 0
sk equ 1
di equ 2
;---------------
;used transmiting the first bits in commands
start_bits
bcf ra,sk
nop
bsf ra,cs
nop
bsf ra,di
nop
bsf ra,sk
nop
bcf ra,sk
retlw 0
;------------------
;the route of transmitting a byte
trmit ;
movlw 8
movwf bit_count
trm0
bcf 3,0
bcf ra,sk
rlf temr
btfss 3,0
goto ^+3
bsf ra,di
goto ^+2
bcf ra,di
nop
bsf ra,sk
decfsz bit_count
goto trm0
retlw 0h
;---------------------
;the route of receiving a byte
receive
movlw 8h
movwf bit_count
clrf temr
rv0
bsf ra,sk
nop
nop
bsf 3,0
bcf ra,sk
nop
btfss ra,do
bcf 3,0
rlf temr
decfsz bit_count
goto rv0
retlw 0h
;=============================
; read a word data.
; the data in rom_ad is the address of
; the word, which come from main route
rd_rom
movlw 080h
iorwf rom_ad
movfw rom_ad
movwf temr
call start_bits
call trmit
rc_da
nop
bcf ra,sk
nop
btfsc ra,do
retlw 0ffh
call receive
movfw temr
movwf data_hi
call receive
movfw temr
movwf data_lo
bcf ra,cs
retlw 0
;=============================
; write a word data.
; the data in rom_ad is the address of
; the word, which come from main route
wrt
movlw 40h
iorwf rom_ad
movfw rom_ad
movwf temr
call start_bits
call trmit
movfw data_hi
movwf temr
call trmit
movfw data_lo
movwf temr
bcf ra,cs
retlw 0h
;-----------------------------
ewen
movlw cm_ewen
goto ewds+1
ewds
movlw cm_ewds
movwf rom_ad
movfw rom_ad
movwf temr
call start_bits
call trmit
bcf ra,cs
retlw 0h

华大智造在汉首发“大人群基因组学一站式解决方案”
电机过载保护是什么原因造成的 电机过载保护怎么解决
个性LED台灯制作教程 激光切割
如何对一维数组做maxpooling
在元件封装选择元件时需要考虑哪些问题
PIC单片机的读写93C46程序
LTC2387-18正弦信号驱动器的设计要求
350W环形变压器电路
工业级PDA高精度导航定位
苹果13promax首发价是多少
差分隐私和现有的隐私保护方法相结合:从用户群体中学习的系统架构详解
高效框架互操作性第2部分:数据加载传输瓶颈和RDMA解决方案
立体声信号相位差电平差测试仪设计方案
双十一热水器怎么选?海尔智家Leader热水器线上增幅2位数
3D DRAM还能这样玩?
发光二极管串联和并联后压降会不会改变呢?
荣耀推出了一款名为荣耀8A Pro的手机搭载了Helio P35处理器
韩国朝电池领先国地位前进的目标产生动摇
什么是绿色制造 如何实现绿色制造
智能变电站的优势