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

📄 ht24lc02.asm

📁 HT45RM03A 在電動自行車控制器中的應用
💻 ASM
📖 第 1 页 / 共 2 页
字号:
                     
   clr               sda                        ;wang...
   nop
   set               scl                        ;0
   nop               
   clr               scl
   nop
;----------------------------------------------------------------------                   



;R/W....                     
;----------------------------------------------------------------------                   
   clr               sda                        ;wang...
   nop
   set               scl                        ;0    R/!W
   nop               
   clr               scl
   nop
;----------------------------------------------------------------------                   



;wait  ACK....                     
;----------------------------------------------------------------------                   
    set                 sda
    nop 
    set                sdac
    nop
wait_ACK3:
    clr                 wdt
    sz                  sda
    jmp                 wait_ACK3
    
    
    clr                 sdac         ;wang..
    nop
    clr                 sda          ;wang..
    nop
    
    set                 scl
    nop                
    clr                 scl
    nop
;----------------------------------------------------------------------                   






;write address....                     
;----------------------------------------------------------------------                   
    mov                 a,08h
    mov                 R_T1,a                     ;8
    clr                 sdac


epprom_addrwr2:
    clr                 wdt
    
    clr                 sda
    sz                  R_Bfadr.7
    set                 sda
    
    nop
    nop
    set                 scl
    nop                
    clr                 scl
    nop

    rl                  R_Bfadr
    
    sdz                 R_T1
    jmp                 epprom_addrwr2
;----------------------------------------------------------------------                   



;wait  ACK....                     
;----------------------------------------------------------------------                   
    set                 sda
    nop 
    set 		sdac
    nop
   
wait_ACK4:
    clr			 wdt
    sz 			 sda
    jmp			 wait_ACK4
    
    
    clr			 sdac          ;wang
    nop             
    clr                  sda           ;wang
    nop
    
    set			 scl
    nop			
    clr			 scl
    nop
;----------------------------------------------------------------------                   



;start....                     
;----------------------------------------------------------------------                   
   set 			sda
   nop 			                 
   nop
   set 			scl                        ;start 
   nop 			
   clr 			sda
   nop 			                 
   nop 			
   clr 			scl
;----------------------------------------------------------------------                   



;1010....                     
;----------------------------------------------------------------------                   
   set 			sda                        ;1
   nop
   set 			scl   
   nop 			                    
   nop			
   clr 			scl
       			
   clr 			sda                        ;0  
   nop
   set 			scl    
   nop 			                 
   nop 			                 
   clr 			scl
       			
   set 			sda                        ;1
   nop
   set 			scl
   nop 			
   nop 			                 
   clr 			scl

   clr 			sda                        ;0
   nop
   set 			scl
   nop 			                 
   nop 			
   clr 			scl
;----------------------------------------------------------------------                   



;a2a1a0....                     
;----------------------------------------------------------------------                   
   clr                  sda           ;wang
   nop
   set 			scl                        ;0
   nop			
   nop 			
   clr 			scl
       			
   clr                  sda           ;wang
   nop
   set 			scl                        ;0    
   nop 			
   nop			
   clr 			scl
       			
   clr                  sda           ;wang
   nop
   set 			scl                        ;0
   nop			
   nop 			
   clr 			scl
;----------------------------------------------------------------------                   



;Read (R/W  High is read) signal....                     
;----------------------------------------------------------------------                   
   set 			sda                        ;1    R/!W
   nop
   set 			scl      
   nop 			       
   clr 			scl
;----------------------------------------------------------------------                   



;wait  ACK....                     
;----------------------------------------------------------------------                   
    set                 sda
    nop 
    set 		sdac
    nop
    nop 			                 
   
wait_ACK5:
    clr			 wdt
    sz 			 sda
    jmp			 wait_ACK5
    
    
    clr			 sdac          ;wang
    nop             
    clr                  sda           ;wang
    nop
        
    set			 scl
    nop			
    nop			
    clr			 scl
;----------------------------------------------------------------------                   



;read data....                     
;----------------------------------------------------------------------                   
    mov 		a,08h
    mov 		R_T1,a                      ;8

    SET                 SDA
    NOP
    set 		sdac
    nop
    nop

read_llp: 
    clr 		wdt 



    clr                 c 
    sz 			sda
    set			c
    rlc 		R_BfIn


    nop 
    set			scl
    nop			
    nop			
    nop 
    nop 
    nop 
    nop 
    nop 
    nop 
    nop 
    nop 
    nop 
    nop 
    clr			scl

    nop 
    nop 
    nop 
    nop 
    nop 
    nop 
    nop 
    nop 
    nop 
    nop 
    nop 


    sdz			R_T1
    jmp			read_llp

    clr 		sdac
    nop
    nop
;----------------------------------------------------------------------                   
  


;NO-ACK....                     
;----------------------------------------------------------------------                   
    SET        		sda                       ;SDA '1'.
    nop
    set			scl
    nop			
    clr			scl
    nop
    clr        		sda 
;----------------------------------------------------------------------                   





;stop....                     
;----------------------------------------------------------------------                   
    CLR       		SCL	                  ;  
    NOP
    CLR       		SDA
    NOP
    SET       		SCL                     ;
    NOP
    SET       		SDA                     ; 
;----------------------------------------------------------------------                   
        		
    mov 		a,R_BfIn
    mov 		R_dataepprom,a
    nop 		
    nop 


    mov 		a,data_sz
    xor 		a,R_BfIn
    snz 		z
    jmp 		ERERROR
    jmp 		READ_ok
   
READ_ok:   
    set 		F_ReadEppromOKF
    RET
readepprom ENDP  
;=============================================================================



;=============================================================================
ERERROR:
  jmp  ERERROR      
;===========================add=============================================

⌨️ 快捷键说明

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