电子文章 | 电子资料下载 | 家电维修 | 维修资料下载 | 加入收藏 | 全站地图
您现在所在位置:电子爱好者电子文章电子电路图单片机电路图SST89C58电子盘电路及代码

SST89C58电子盘电路及代码

03-19 02:35:27 | http://www.5idzw.com | 单片机电路图 | 人气:300
标签:电路图讲解,电路图练习,http://www.5idzw.com SST89C58电子盘电路及代码,http://www.5idzw.com
        mov   B,        #0
        mov   dptr,    #Data_Reg
        mov   SFAH, #high(FlashAddrs)
        mov   SFAL, #low(FlashAddrs)
        orl      SFCF, #40h        ; set IAPEN=1 to enable IAP

read:        movx  a,  @dptr         ; read 1 byte data from ADC

        mov   SFDT, a           ; program into on-chip flash
        mov   SFCM, #0Eh    ; issue Byte-Program command
        acall   Done?          ; wait until done

        mov   a,  SFAL          ; adjust the address of flash
        add    a,  #1
        mov   SFAL, a
        mov   a,  SFAH
        addc  a,  #0        
        mov   SFAH, a

        djnz  B,   read
        djnz  R7, read

        anl   SFCF, #0BFh        ; disable IAP
        ret                     
;========================================
Compare:      mov   dptr,    #message         ;  point to message

        mov   SFAH,  #high(FlashAddrs)
        mov   SFAL,  #low(FlashAddrs)

        orl      SFCF, #40h            ; IAPEN=1
                      clr      F0
        mov   R7,   #2
        mov   B,    #0

verify:        clr       a
        movc  a,    @a+dptr           ; get  original data in message
               inc     dptr
        mov   SFCM, #0Ch            ; issue BYTE-VERIFY command
        nop
        xrl     a, SFDT         ; SFDT contains data  in flash, these data come from ADC
        jz      skip

        setb  F0                         ; set flag F0 (PSW.5) if any discrepancy.

skip:         mov   a,  SFAL              ; increase the address of flash
        add    a,  #1
        mov   SFAL, a
        mov   a,  SFAH
        addc  a,  #0        
        mov   SFAH, a

        djnz  B,  verify
        djnz  R7, verify
            
        anl   SFCF, #0BFh           ; disable IAP
        ret
            
;========================================================================

message:      DB  "This demo program demonstrates how easy to design "
        DB  "SST ATA-Disk Chip into SST FlashFlex51 embedded microcontroller. "
        DB  "After you understand how to use the basic WriteSector and ReadSector "
        DB  "functions, it's easy to try any others."
        DB  "The hardware connection between ADC and MCU is also very simple,"
        DB  "just like you expand any I/O or data memory in your application system. "

上一页  [1] [2] [3] [4] [5] [6]  下一页

,SST89C58电子盘电路及代码
关于《SST89C58电子盘电路及代码》的更多文章