历史上的今天
今天是:2024年12月16日(星期一)
2019年12月16日 | PIC单片机的读写93XCXX程序
2019-12-16 来源:elecfans
TITLE "R/W EEPROM"
LIST P = 16C54
;Serial Eprom interface to PIC16C5X.
;REV 2.0 8/26/92.
;
;Define Equates:
;
PIC54 EQU 1FFH
;
PAGE
;
ORG 0
START
goto main ;run test program
;
PAGE
;
TRUE EQU 1
FALSE EQU 0
S93C46 EQU FALSE
S93LC46 EQU FALSE
S93C56 EQU FALSE
S93LC56 EQU FALSE
S93C66 EQU TRUE
S93LC66 EQU FALSE
wire3 equ TRUE
org8 EQU FALSE
;
IF S93LC46
IF org8
LC468 EQU TRUE
XC46 EQU FALSE
H16 EQU FALSE
H8 EQU FALSE
ELSE
LC468 EQU FALSE
XC46 EQU TRUE
H16 EQU FALSE
H8 EQU FALSE
ENDIF
ELSE
ENDIF
IF S93C46
LC468 EQU FALSE
XC46 EQU TRUE
H16 EQU FALSE
H8 EQU FALSE
ENDIF
IF S93C56 + S93C66 + S93LC56 + S93LC66
IF org8
H8 EQU TRUE
H16 EQU FALSE
LC468 EQU FALSE
XC46 EQU FALSE
ELSE
H16 EQU TRUE
H8 EQU FALSE
LC468 EQU FALSE
XC46 EQU FALSE
ENDIF
ELSE
ENDIF
;********************************************************************
;* Register Assignments *
;********************************************************************
indir equ 0 ;Use this register as source/desTInaTIon
;for indirect addressing.
pc equ 2 ;PIC Program Counter.
status equ 3 ;PIC Status Register.
fsr equ 4 ;File Select Register.
serial equ 5 ;Port used for 93CX6 control.
;The following four registers must be
;located consecuTIvely in memory.
cmd equ 1a ;This register contains the 4 bit
;command op code for 93CX6 as follows:
;bit 7 msb of command op code
;bit 6 next bit of op code
;bit 5 next bit of op code
;bit 4 lsb of op code
;bit 3 A8 of address in case of
;56/66 in 8 bit mode.
addr equ 1b ;memory address of lower 7/8 bits
highb equ 1c ;Used in read/write routines to store the
;upper byte of a 16 bit data word,
;or the data in a 8 bit data word
lowb equ 1d ;Used in read/write routines to store the
;lower byte of a 16 bit data word,
;or not used in 8 bit data word.
cnthi equ 1e ;Used as the upper byte of a sixteen bit
;loop counter in RDYCHK routine.
cnt equ 1f ;Used as the lower byte of a sixteen bit
;loop counter in RDYCHK routine, and
;elswhere as an eight bit counter.
temp_cmd equ 1e ;doubles as a temp register for cmd
temp_addr equ 1f ;doubles as a temp register for addr
;********************************************************************
;* Bit Assignments *
;********************************************************************
carry equ 0 ;Carry Flag of Status Register.
zflag equ 2 ;Zero Flag of Status Register.
cs equ 2 ;Port pin tied to CS on 93CX6.
din equ 1 ;Port pin tied to DI on 93CX6.
dout equ 1 ;Port pin tied to DO on 93CX6.
clock equ 3 ;Port pin tied to CLK on 93CX6.
;********************************************************************
;* General Assignments *
;********************************************************************
no_err equ 0
error equ 1
tries equ 20 ;After issuing a WRITE, ERASE, ERAL, or WRAL
;command, the approximate number of machine
;cycles X 256 to wait for the RDY status.
;This value must be adjusted for operating
;frequencies other than 4 MHz.
read equ b'10000000' ;read command op code
write equ b'01000000' ;write command op code
erase equ b'11000000' ;erase command op code
ewen equ b'00110000' ;erase enable command op code
ewds equ b'00000000' ;erase disable command op code
eral equ b'00100000' ;erase all command op code
wral equ b'00010000' ;write all command op code
;********************************************************************
;* Macro Definitions *
;********************************************************************
sel MACRO ;Selects the 93CX6 device.
bsf serial,cs ;Chip Select (CS) = '1' to select
ENDM ;the device
dsel MACRO ;De-select the 93CX6 device.
bcf serial,cs ;Chip Select (CS) = '0' to de-select
;the device.
ENDM
strtbt MACRO ;Issue the Start Bit to the 93CX6.
bsf serial,din ;Start Bit = '1'.
clkit ;Clock it out.
ENDM
史海拾趣
|
字符液晶1602和点阵液晶12864 地址的疑惑(初学者提问) 字符液晶1602 确定显示位置的时候 80H 加上地址码 00H-27H 40H-67H。对于80H是如何得出来的? 点阵液晶12864 确定显示位置的时候 B8H 加上页码 40H 加上列码。 对于B8H 40H ...… 查看全部问答> |
|
【课程推荐】+ TI C2000无锡研讨会-太阳能微逆变器解决方案 平时没事看看TI的视频,发现有活动,顺便参加一些,希望拿个奖品,先谢谢TI和eeworld 这次我推荐的课程是 TIC2000无锡研讨会-太阳能微逆变器解决方案 主讲是朱桦 新能源是一个比较大的方向,相信有很多人都是从事这一方面。众所周知的是太阳能变 ...… 查看全部问答> |
|
各位高手,小弟正在分析openpilot源代码,分析到了以下代码:OPLinkSettingsData oplinkSettings; OPLinkSettingsGet(&oplinkSettings);bool is_coordinator = (oplinkSettings.Coordinator == OPLINKSETTINGS_COORDINATOR_TRUE);&nbs ...… 查看全部问答> |
|
我非常喜欢读ADI提供的技术文档比如ADI的大部分数据手册中都会有技术术语或使用技巧的介绍对理解和应用某些产品和技术帮助很大特别是他提供的中文手册翻译的非常全面,通篇都是中文介绍 这次在ADA4817放大器的数据手册里看到了关于布局布线、接地 ...… 查看全部问答> |




