标签:电路图讲解,电路图练习,http://www.5idzw.com
SST89C58电子盘电路及代码,http://www.5idzw.com
Sectr_Cnt Equ 8002h ; Sector Count Register ( R / W )
Sectr_No Equ 8003h ; Sector Number Register, or LBA0:7 ( R / W )
Cylinder_Low Equ 8004h ; Cylinder Low Register or LBA8:15 ( R / W )
Cylinder_Hi Equ 8005h ; Cylinder High Register or LBA16:23 ( R / W )
Drv_Head Equ 8006h ; Drive Head Register ( R / W )
Status Equ 8007h ; Status Register, read only
Command Equ 8007h ; Command Register, write only
Alt_Status Equ 4006h ; Alternate Status Register, read only,
; reading Alt_Status doesn't clear interrupt pending flag. Not used in this demo.
Device_Ctrl Equ 4006h ; Device Control Register, write only. Not used in this demo.
Drive_Addrs Equ 4007h ; Drive Address Register, read only. Not used in this demo.
;=================================================================
; SST FlashFlex51 microcontroller related SFR's definition
SFCF DATA 0B1H ; SuperFlash Configuration
SFCM DATA 0B2H ; SuperFlash Command
SFAL DATA 0B3H ; SuperFlash Address Low
SFAH DATA 0B4H ; SuperFlash Address High
SFDT DATA 0B5H ; SuperFlash Data
SFST DATA 0B6H ; SuperFlash Status
WDTC DATA 0C0H ; Watchdog Timer Control
WDTD DATA 86H ; Watchdog Timer Data/Reload
;=================================================================
; constant definition
FlashAddrs Equ 0F800h ; start address to store data from ADC
;===========================================
org 0000h
ljmp start
org 0100h
start: clr P1.4 ; reset ADC
nop
nop
nop
nop
setb P1.4
mov r4, #5 ; delay 0.5 second
loadr5: mov r5, #200 ; delay 0.1 second
loadr6: mov r6, #250 ; delay 0.5ms for 12MHz crystal
djnz r6, $
djnz r5, loadr6
djnz r4, loadr5
acall Enable8bit ; First of all, enable 8 bits operation!
;========================================
orl SFCF, #40h ; IAPEN=1
mov SFAH, #high(FlashAddrs)
mov SFAL, #low(FlashAddrs)
mov B, #8 ; erase 8 sectors (512 bytes)
;========================================
erase: mov SFCM, #0Bh ; sector erase!
acall Done?
mov a, SFAL
add a, #64 ; 64 bytes / sector in Block 1 of SST89C54/58
mov SFAL, a
mov a, SFAH
addc a, #0
mov SFAH, a
djnz B, erase
anl SFCF, #0BFh ; disable IAP
,SST89C58电子盘电路及代码
Sectr_Cnt Equ 8002h ; Sector Count Register ( R / W )
Sectr_No Equ 8003h ; Sector Number Register, or LBA0:7 ( R / W )
Cylinder_Low Equ 8004h ; Cylinder Low Register or LBA8:15 ( R / W )
Cylinder_Hi Equ 8005h ; Cylinder High Register or LBA16:23 ( R / W )
Drv_Head Equ 8006h ; Drive Head Register ( R / W )
Status Equ 8007h ; Status Register, read only
Command Equ 8007h ; Command Register, write only
Alt_Status Equ 4006h ; Alternate Status Register, read only,
; reading Alt_Status doesn't clear interrupt pending flag. Not used in this demo.
Device_Ctrl Equ 4006h ; Device Control Register, write only. Not used in this demo.
Drive_Addrs Equ 4007h ; Drive Address Register, read only. Not used in this demo.
;=================================================================
; SST FlashFlex51 microcontroller related SFR's definition
SFCF DATA 0B1H ; SuperFlash Configuration
SFCM DATA 0B2H ; SuperFlash Command
SFAL DATA 0B3H ; SuperFlash Address Low
SFAH DATA 0B4H ; SuperFlash Address High
SFDT DATA 0B5H ; SuperFlash Data
SFST DATA 0B6H ; SuperFlash Status
WDTC DATA 0C0H ; Watchdog Timer Control
WDTD DATA 86H ; Watchdog Timer Data/Reload
;=================================================================
; constant definition
FlashAddrs Equ 0F800h ; start address to store data from ADC
;===========================================
org 0000h
ljmp start
org 0100h
start: clr P1.4 ; reset ADC
nop
nop
nop
nop
setb P1.4
mov r4, #5 ; delay 0.5 second
loadr5: mov r5, #200 ; delay 0.1 second
loadr6: mov r6, #250 ; delay 0.5ms for 12MHz crystal
djnz r6, $
djnz r5, loadr6
djnz r4, loadr5
acall Enable8bit ; First of all, enable 8 bits operation!
;========================================
orl SFCF, #40h ; IAPEN=1
mov SFAH, #high(FlashAddrs)
mov SFAL, #low(FlashAddrs)
mov B, #8 ; erase 8 sectors (512 bytes)
;========================================
erase: mov SFCM, #0Bh ; sector erase!
acall Done?
mov a, SFAL
add a, #64 ; 64 bytes / sector in Block 1 of SST89C54/58
mov SFAL, a
mov a, SFAH
addc a, #0
mov SFAH, a
djnz B, erase
anl SFCF, #0BFh ; disable IAP
,SST89C58电子盘电路及代码
上一篇:LMl872 基本测试电路图