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

📄 led.asm

📁 永磁同步电机驱动控制
💻 ASM
📖 第 1 页 / 共 2 页
字号:
    ldpk  _isd
    lacc  _isd
    bgez   value_no3_aa
    ldpk   neg_flag_1
    splk   #1,neg_flag_1
    b      value_no3_bb
value_no3_aa:
    ldpk   neg_flag_1
    splk   #0,neg_flag_1
value_no3_bb:    
    ldpk   _isd
    lacc   _isd
    abs
    ldpk   buffer
    sacl   buffer
    call   chd
    ret
    
value_no4_show:  
    ldpk  _current_given
    lacc  _current_given
    bgez   value_no4_aa
    ldpk   neg_flag_1
    splk   #1,neg_flag_1
    b      value_no4_bb
value_no4_aa:
    ldpk   neg_flag_1
    splk   #0,neg_flag_1
value_no4_bb:    
    ldpk   _current_given
    lacc   _current_given
    abs
    ldpk   buffer
    sacl   buffer
    call   chd
    ret        
    
value_no5_show:  
    ldpk  _current_udref
    lacc  _current_udref
    bgez   value_no5_aa
    ldpk   neg_flag_1
    splk   #1,neg_flag_1
    b      value_no5_bb
value_no5_aa:
    ldpk   neg_flag_1
    splk   #0,neg_flag_1
value_no5_bb:    
    ldpk   _current_udref
    lacc   _current_udref
    abs
    ldpk   buffer
    sacl   buffer
    call   chd
    ret        

value_no6_show:  
    ldpk  _n_feed
    lacc  _n_feed
    bgez   value_no6_aa
    ldpk   neg_flag_1
    splk   #1,neg_flag_1
    b      value_no6_bb
value_no6_aa:
    ldpk   neg_flag_1
    splk   #0,neg_flag_1
value_no6_bb:    
    ldpk   _n_feed
    lacc   _n_feed
    abs
    ldpk   buffer
    sacl   buffer
    call   chd
    ret       
                        
point_chd:
    splk   #1,point_flag
    lacc   temp_low
    sacl   led01
    lacc   temp_high
    rpt    #15
    subc   count_value
    sach   led02
    sacl   temp_high
    lacc   temp_high
    rpt    #15
    subc   count_value
    sach   led03
    sacl   temp_high
    lacc   temp_high
    rpt    #15
    subc   count_value
    sach   led04
    sacl   temp_high
    lacc   temp_high
    rpt    #15
    subc   count_value
    sach   led05
    sacl   led06
    ret

chd:
    splk   #0,point_flag
    lacc  buffer
    rpt    #15
    subc   count_value
    sach   led01
    sacl   buffer
    lacc   buffer
    rpt    #15
    subc   count_value
    sach   led02
    sacl   buffer
    lacc   buffer
    rpt    #15
    subc   count_value
    sach   led03
    sacl   buffer
    lacc   buffer
    rpt    #15
    subc   count_value
    sach   led04
    sacl   buffer
    lacc   buffer
    rpt    #15
    subc   count_value
    sach   led05
    lacc   neg_flag_1
    bnz    hqb1
    lacc   #17
    sacl   led06
    ret
hqb1:
    splk   #20,led06
    ret    

       
;====================
;set mode
;====================        
set_mode:
    lacc   led01
    add    led02,3
    add    led02,1
    sacl   set_data
    sub    #1
    bz     set_no1
    b      ret_key 
    
set_no1:   
    ldpk   _n_ref
    lacc   _n_ref 
    bgez   set_no1_aa
    ldpk   buffer
    splk   #1,neg_flag_1
    b      set_no1_bb
set_no1_aa:
    ldpk   buffer
    splk   #0,neg_flag_1
    
set_no1_bb:    
    ldpk   _n_ref
    lacc   _n_ref
    abs    
    ldpk   buffer
    sacl   buffer
    call   chd
    splk   #1,led_pos
    splk   #21h,confirm
    b      ret_key    
        
;=====================
;set value mode
;=====================    
set_value:
    lacc  set_data
    sub   #1
    bz    value_no1
    b     ret_key                  		
value_no1:
    call  rev_chd
    lacc  buffer
    ldpk  _n_ref
    sacl  _n_ref
    ldpk  led_pos
    splk  #0,led_pos
    ret
                     						
rev_chd:
    lacc  led06
    sub   #020
    bz    neg_flag_pro
    splk  #0,neg_flag
    b     rev_chd1
neg_flag_pro:
    splk  #1,neg_flag    
rev_chd1:        
    lacc  led05
    sub   #5
    bgz   ret_key
    lt    led05
    mpy   count_value2
    spm   0
    pac   
    lt    led04
    mpy   #1000
    apac
    lt    led03
    mpy   #100
    apac
    lt    led02
    mpy   #10
    apac
    add   led01
    sacl  buffer 
    lacc  neg_flag
    bnz   hqb
    ret
hqb:
    lacc  buffer
    neg
    sacl  buffer
    ret
;===========================================================
;数码管代码获取              	
;===========================================================     
getcode: 
    ldp	  #led01
    lacc  led01
    add   #table
    tblr  ledcode01
    tblr  ledcodeflash01
    
    lacc  led02
    add   #table
    tblr  ledcode02
    tblr  ledcodeflash02
    
    lacc  led03
    add   #table
    tblr  ledcode03
    tblr  ledcodeflash03
    
    lacc  led04
    add   #table
    tblr  ledcode04
    tblr  ledcodeflash04
    
    lacc  led05
    add   #table
    tblr  ledcode05
    tblr  ledcodeflash05
    
    lacc  led06
    add   #table
    tblr  ledcode06
    tblr  ledcodeflash06
    
    lacc  led_pos
    bz    no_flash
    sub   #1
    bz    flash_no1
    sub   #1
    bz    flash_no2
    sub   #1
    bz    flash_no3
    sub   #1
    bz    flash_no4
    sub   #1
    bz    flash_no5
    sub   #1
    bz    flash_no6
    splk  #0,led_pos
    b     no_flash
flash_no1:
    splk  #0,ledcodeflash01
    b     no_flash
flash_no2:
    splk  #0,ledcodeflash02
    b     no_flash
flash_no3:
    splk  #0,ledcodeflash03
    b     no_flash 
flash_no4:
    splk  #0,ledcodeflash04
    b     no_flash
flash_no5:
    splk  #0,ledcodeflash05
    b     no_flash
flash_no6:
    splk  #0,ledcodeflash06
            
no_flash:
    lacc  point_flag
    bnz   point
    ret
point:                                  ;取小数点
    lacc  ledcode02
    add   #80h
    sacl  ledcode02
    lacc  ledcodeflash02
    add   #80h
    sacl  ledcodeflash02    
    ret
no_show:
    lacc  led06
    bz    no_show_06    
    ret 
no_show_06:
    splk  #0,ledcode06
    splk  #0,ledcodeflash06
    lacc  led05
    bz    no_show_05    
    ret 
no_show_05          
    splk  #0,ledcode05
    splk  #0,ledcodeflash05
    lacc  led04
    bz    no_show_04    
    ret  
no_show_04:
    splk  #0,ledcode04
    splk  #0,ledcodeflash04
    lacc  led03
    bz    no_show_03    
    ret 
no_show_03:
    splk  #0,ledcode03
    splk  #0,ledcodeflash03
    lacc  led02
    bz    no_show_02    
    ret  
no_show_02:
    splk  #0,ledcode02
    splk  #0,ledcodeflash02
    lacc  led01
    bz    no_show_01    
    ret 
no_show_01:
    splk  #0,ledcode01    
    splk  #0,ledcodeflash01
    ret
    	 			                
;-----------------------------------------------------------------------------------
 
;===========================================================
;T1定时中断
;===========================================================
  
_led_show:
        call    key_read 
        call    value_show
        call    display
        ret
display:
        lacc    flash_num
        add     #1
        sacl    flash_num
        sub     #1500
        bgz     flash_flag   
        ret
flash_flag:
        splk   #1,flash_num
        lacc   flash_code
        bz     no_led_flash
        b      flash_led_code
       
no_led_flash:        
       splk   #1,flash_code
       lacc   ledcode01,8
       add   ledcode02
       sacl   Temp1
       out   Temp1,led3
       
       lacc   ledcode03,8
       add   ledcode04
       sacl   Temp1
       out   Temp1,led2
       
       lacc   ledcode05,8
       add   ledcode06
       sacl   Temp1
       out   Temp1,led1
       
       ret
flash_led_code:
       splk   #0,flash_code
       lacc   ledcodeflash01,8
       add     ledcodeflash02
       sacl    Temp1
       out     Temp1,led3
       
       lacc   ledcodeflash03,8
       add     ledcodeflash04
       sacl    Temp1
       out     Temp1,led2
       
       lacc   ledcodeflash05,8
       add     ledcodeflash06
       sacl    Temp1
       out     Temp1,led1
       
       ret

table:
	.word	#003fh      ;0
	.word	#0006h      ;1
	.word	#005bh
	.word	#004fh
	.word	#0066h
	.word	#006dh
	.word	#007dh
	.word	#0007h
	.word	#007fh
	.word	#006fh      ;9
	.word	#0008h      ;_ 
	.word	#0079h      ;E
	.word	#0076h      ;H
	.word	#0038h      ;L
	.word	#003Fh      ;O
	.word	#006dh      ;S
	.word	#0007h      ;T
	.word   #0000h      ;无显示
	.word   #005ch
	.word   #0078h
    .word   #0040h       ;"-" 
    .word   #0077h      ;R
    .word   #003Eh      ;V   
    .WORD   #0078H      ;t  
    .WORD   #005eH      ;d
    .word   #0073h      ;p
    .word   #0040h      ;-

⌨️ 快捷键说明

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