⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 at25cxx.lst

📁 AT25F512 Serial EEPROMs with AT89.rar. 通过spi通信
💻 LST
📖 第 1 页 / 共 4 页
字号:
                     384     
0113 C292            385                     clr     CS              ; select device
                     386     
0115 7405            387                     mov     a, #RDSR        ; get command
0117 120235          388                     call    shout           ; send command
                     389     
011A 120220          390                     call    shin            ; get status
                     391     
011D D292            392                     setb    CS              ; deselect device
011F 22              393                     ret
                     394     
                     395     
                     396     write_status:
                     397     
                     398             ; Write device status.
                     399             ; Does not check for device ready before sending command.
                     400             ; Called with status byte to send in A.
                     401             ; Returns nothing.
                     402     
0120 C292            403                     clr     CS              ; select device
                     404     
0122 C0E0            405                     push    acc             ; save status
0124 7401            406                     mov     a, #WRSR        ; get command
0126 120235          407                     call    shout           ; send command
                     408     
0129 D0E0            409                     pop     acc             ; restore status
012B 120235          410                     call    shout           ; send status
                     411     
012E C293            412                     clr     SCK             ; drop clock
0130 00              413                     nop                     ; enforce delay
0131 D292            414                     setb    CS              ; deselect device
0133 22              415                     ret
                     416     
                     417     
                     418     enable_write:
                     419     
                     420             ; Enable write.
                     421             ; Does not check for device ready before sending command.
                     422             ; Returns nothing. Destroys A.
                     423     
0134 C292            424                     clr     CS              ; select device
                     425     
0136 7406            426                     mov     a, #WREN        ; get command
0138 120235          427                     call    shout           ; send command
                     428     
013B C293            429                     clr     SCK             ; drop clock
013D 00              430                     nop                     ; enforce delay
013E D292            431                     setb    CS              ; deselect device
0140 22              432                     ret
                     433     
                     434     
                     435     disable_write:
MCS-51 MACRO ASSEMBLER    CONTROL_AT25XXX                                                           02/06/96   PAGE    9


LOC  OBJ            LINE     SOURCE

                     436     
                     437             ; Disable write.
                     438             ; Does not check for device ready before sending command.
                     439             ; Returns nothing. Destroys A.
                     440     
0141 C292            441                     clr     CS              ; select device
                     442     
0143 7404            443                     mov     a, #WRDI        ; get command
0145 120235          444                     call    shout           ; send command
                     445     
0148 C293            446                     clr     SCK             ; drop clock
014A 00              447                     nop                     ; enforce delay
014B D292            448                     setb    CS              ; deselect device
014D 22              449                     ret
                     450     
                     451     
                     452     read_byte:
                     453     
                     454             ; Read one byte of data from specified address.
                     455             ; Does not check for device ready before sending command.
                     456             ; Called with address in DPTR.
                     457             ; Returns data in A.
                     458     
014E C292            459                     clr     CS              ; select device
                     460     
0150 E583            461                     mov     a, dph          ; get high byte of address
0152 13              462                     rrc     a               ; move LSB into carry bit
0153 7403            463                     mov     a, #READ        ; get command
0155 92E3            464                     mov     A8, c           ; combine command and high bit of addr
0157 120235          465                     call    shout           ; send command and high bit of address
                     466     
015A E582            467                     mov     a, dpl          ; get low byte of address
015C 120235          468                     call    shout           ; send low byte of address
                     469     
015F 120220          470                     call    shin            ; get data
                     471     
0162 D292            472                     setb    CS              ; deselect device
0164 22              473                     ret
                     474     
                     475     
                     476     write_byte:
                     477     
                     478             ; Write one byte of data to specified address.
                     479             ; Does not check for device ready or write enabled before sending
                     480             ; command. Does not wait for write cycle to complete before returning.
                     481             ; Called with address in DPTR, data in A.
                     482             ; Returns nothing.
                     483     
0165 C292            484                     clr     CS              ; select device
                     485     
0167 C0E0            486                     push    acc             ; save data
0169 E583            487                     mov     a, dph          ; get high byte of address
016B 13              488                     rrc     a               ; move LSB into carry bit
016C 7402            489                     mov     a, #WRITE       ; get command
016E 92E3            490                     mov     A8, c           ; combine command and high bit of addr
MCS-51 MACRO ASSEMBLER    CONTROL_AT25XXX                                                           02/06/96   PAGE   10


LOC  OBJ            LINE     SOURCE

0170 120235          491                     call    shout           ; send command and high bit of address
                     492     
0173 E582            493                     mov     a, dpl          ; get low byte of address
0175 120235          494                     call    shout           ; send low byte of address
                     495     
0178 D0E0            496                     pop     acc             ; restore data
017A 120235          497                     call    shout           ; send data
                     498     
017D C293            499                     clr     SCK             ; drop clock
017F 00              500                     nop                     ; enforce delay
0180 D292            501                     setb    CS              ; deselect device
0182 22              502                     ret
                     503     
                     504     
                     505     read_page:
                     506     
                     507             ; Read one page of data beginning at specified address.
                     508             ; Does not check for device ready before sending command.
                     509             ; Called with address in DPTR.
                     510             ; Returns data in BUFFER. Destroys A, INDEX.
                     511     
0183 C0F0            512                     push    b
                     513     
0185 C292            514                     clr     CS              ; select device
                     515     
0187 E583            516                     mov     a, dph          ; get high byte of address
0189 13              517                     rrc     a               ; move LSB into carry bit
018A 7403            518                     mov     a, #READ        ; get command
018C 92E3            519                     mov     A8, c           ; combine command and high bit of addr
018E 120235          520                     call    shout           ; send command and high bit of address
                     521     
0191 E582            522                     mov     a, dpl          ; get low byte of address
0193 120235          523                     call    shout           ; send low byte of address
                     524     
0196 75F008          525                     mov     b, #PSIZE       ; bytes per page
0199 7820            526                     mov     index, #buffer  ; point to buffer
                     527             ee10:
019B 120220          528                     call    shin            ; get data
019E F6              529                     mov     @index, a       ; save data
                     530     
019F 08              531                     inc     index           ; advance buffer pointer
01A0 D5F0F8          532                     djnz    b, ee10         ; next byte
                     533     
01A3 D292            534                     setb    CS              ; deselect device
                     535     
01A5 D0F0            536                     pop     b
01A7 22              537                     ret
                     538     
                     539     
                     540     write_page:
                     541     
                     542             ; Write one page of data beginning at specified address.
                     543             ; Does not check for device ready or write enabled before sending
                     544             ; command. Does not wait for write cycle to complete before returning.
                     545             ; Called with address in DPTR, data in BUFFER.
MCS-51 MACRO ASSEMBLER    CONTROL_AT25XXX                                                           02/06/96   PAGE   11


LOC  OBJ            LINE     SOURCE

                     546             ; Returns nothing. Destroys A, B, INDEX.
                     547     
01A8 C0F0            548                     push    b
                     549     
01AA C292            550                     clr     CS              ; select device
                     551     
01AC E583            552                     mov     a, dph          ; get high byte of address
01AE 13              553                     rrc     a               ; move LSB into carry bit
01AF 7402            554                     mov     a, #WRITE       ; get command
01B1 92E3            555                     mov     A8, c           ; combine command and high bit of addr
01B3 120235          556                     call    shout           ; send command and high bit of address
                     557     
01B6 E582            558                     mov     a, dpl          ; get low byte of address
01B8 120235          559                     call    shout           ; send low byte of address
                     560     
01BB 75F008          561                     mov     b, #PSIZE       ; bytes per page
01BE 7820            562                     mov     index, #buffer  ; point to buffer
                     563             ee11:
01C0 E6              564                     mov     a, @index       ; get data from buffer
01C1 120235          565                     call    shout           ; send data
                     566     
01C4 08              567                     inc     index           ; advance buffer pointer
01C5 D5F0F8          568                     djnz    b, ee11         ; next byte
                     569     
01C8 C293            570                     clr     SCK             ; drop clock
01CA 00              571                     nop                     ; enforce delay
01CB D292            572                     setb    CS              ; deselect device
                     573     
01CD D0F0            574                     pop     b
01CF 22              575                     ret
                     576     
                     577     
                     578     commander:
                     579     
                     580             ; Execute AT25xxx command.
                     581             ; Called with command code in A, address (if required) in
                     582             ; HADDR:LADDR, output data (if required) in XDATA.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -