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

📄 zz-yjcut.asm

📁 pic资料
💻 ASM
📖 第 1 页 / 共 5 页
字号:
       goto          $       
iic_save
	 movlw         aen1_zong
	 movwf         iic_back_addr
	 movlw         0x00
	 movwf         iic_addr
	 movlw         0x08
	 movwf         iic_count
	 call          iic_write
	 retlw         0 
;--------------------------------------
Delay_1ms
	movlw		.1
	goto		Delay_ms
Delay_2ms
	movlw		.2
	goto		Delay_ms
Delay_3ms
	movlw		.3
	goto		Delay_ms	

Delay_10ms
	movlw		.10
	goto		Delay_ms

Delay_200ms
	movlw		.200
	goto		Delay_ms
;/---------------------------------------------------------------------------------/
;/延时1mS程序
;/输入:无
;/输出:无
;/影响数据:W,STATUS,generalCountSix
;/备注:晶振为8MHZ
;/----------------------------------------------------------------------------------/
Delay_ms
	movwf		DelaymsCount1
Delay_msloop1
	movlw		.100
	movwf		DelaymsCount0

Delay_msloop2
	goto		$+1
	goto		$+1
	goto		$+1
	goto		$+1
	goto		$+1
	goto		$+1
	goto		$+1
	goto		$+1
	nop
	decfsz		DelaymsCount0
	goto		Delay_msloop2

	decfsz		DelaymsCount1
	goto		Delay_msloop1 
	nop
	retlw		0 		
delay 
       	 clrwdt                    ;delay 6ms
         clrf         r0
         movlw        h'2'   ; h'6'
         movwf        r1 
         decfsz       r0
         goto         $-1
         decfsz       r1
         goto         $-3
         clrwdt
         retlw        0 
delay1    
         movlw        0x16
	     bsf          status,5
	     movwf        temp1
	     call         top2
	     bcf          status,5
	     retlw        0 	
;====================================== 
get7seg
          movlw        high get7seg
          movwf        pclath
     
          movf         lcdtemp1,0
          sublw        0x09
          btfss        status,0
          return
          movf         lcdtemp1,0
          addwf        pcl,1
          retlw        b'10101111' ;b'11101011'  ;0
          retlw        b'00000110' ;b'01100000'  ;1
          retlw        b'01101101' ;b'11000111'  ;2
          retlw        b'01001111' ;b'11100101'  ;3
          retlw        b'11000110' ;b'01101100'  ;4
          retlw        b'11001011' ;b'10101101'  ;5
          retlw        b'11101011' ;b'10101111'  ;6
          retlw        b'00001110' ;b'11100000'  ;7
          retlw        b'11101111' ;b'11101111'  ;8
          retlw        b'11001111' ;b'11111101'  ;9 
	  return  
;-------------------------------------- 
lcd_display 
                 clrwdt
                 bsf          status,5
                 btfsc        flag_display,1
                 goto         display_ok
                 btfsc        flag_display,2
                 goto         display_err
                 goto         display_idem
display_ok
                 call         display_delay 
                 btfsc        flag_display,0
                 goto         display_other   
                 bcf          status,5
                 movlw        0e8h
                 movwf        bcd3 ;f
                 movlw        06h
                 movwf        bcd4 ;1
                 goto         display_bz
display_err
                 call         display_delay  
                 btfsc        flag_display,0
                 goto         display_other  
                 bcf          status,5 
                 movlw        0e8h
                 movwf        bcd3 ;f
                 movlw        6dh
                 movwf        bcd4 ;2
                 goto         display_bz
display_delay          
                 bsf          status,5    
                 movf         display_cn1,0
                 sublw        10h
                 btfsc        status,0
                 retlw        0
                 movf         display_cn2,0    
                 sublw        40h ;4eh
                 btfss        status,0
                 bsf          flag_display,0
                 retlw        0
display_bz
                 bcf          status,5
                 movlw        0
                 movwf        bcd1
                 movwf        bcd2
                 movwf        bcd5
                 movwf        bcd6
                 goto         writelcd
;------------------------------------------------
display_other
                 bcf          flag_display,1
                 bcf          flag_display,2
                 bcf          flag_display,0 
                 clrf         display_cn1
                 clrf         display_cn2 
                 bcf          status,5
                 retlw        0 
display_idem
                 call         display_delay
                 btfss        flag_display,0
                 goto         display_keep 
                 clrf         display_cn1
                 clrf         display_cn2 
                 bcf          flag_display,0
                 btfsc        flag_display,5
                 goto         display_em
                 btfsc        flag_display,6
                 goto         display_id0
                 goto         display_id1
                 
display_keep 
                 btfsc        flag_display,5
                 goto         display_id0
                 btfsc        flag_display,6
                 goto         display_id1
                 goto         display_em
display_id0  
                 bsf          flag_display,5
                 bcf          flag_display,6
                 bcf          status,5
        ;         clrwdt    
		 bsf          ht1621_cs
		 movf         id1,0 
                 call         display_12
	
	         movf         id2,0 
                 call         display_34

		 movf         id3,0 
                 call         display_56
                 bsf          bcd6,4
                 goto         writelcd
display_id1  
                 bcf          flag_display,5
                 bsf          flag_display,6
                 bcf          status,5
       ;          clrwdt    
		 bsf          ht1621_cs
		 movf         id4,0 	         
                 call         display_12
	
	         movf         id5,0 
                 call         display_34

		 movf         id6,0 
                 call         display_56
                 bsf          bcd5,4
                 goto         writelcd
;---------------------------------------
display_12
                 movwf        temp1		 
 		 movf         temp1,0 
	         andlw        0fh
		 movwf        lcdtemp1
		 call         get7seg
		 movwf        bcd4 
		 movf         temp1,0			
		 andlw        0f0h
		 movwf        lcdtemp1 
		 swapf        lcdtemp1 
	  	 call         get7seg
		 movwf        bcd3
                 retlw        0
display_34	
		 movwf        temp1	 
 		 movf         temp1,0 
	         andlw        0fh
		 movwf        lcdtemp1
		 call         get7seg
		 movwf        bcd2 
		 movf         temp1,0			
		 andlw        0f0h
		 movwf        lcdtemp1 
		 swapf        lcdtemp1 
	  	 call         get7seg
		 movwf        bcd1
                 retlw        0
display_56	
		 movwf        temp1	 
 		 movf         temp1,0 
	         andlw        0fh
		 movwf        lcdtemp1
		 call         get7seg
		 movwf        bcd5 
		 movf         temp1,0			
		 andlw        0f0h
		 movwf        lcdtemp1 
		 swapf        lcdtemp1 
	  	 call         get7seg
		 movwf        bcd6
                 retlw        0
;---------------------------------------
display_em
                 bcf          flag_display,5
                 bcf          flag_display,6
                 bcf          status,5
	         clrwdt    
		 bsf          ht1621_cs
		 movf         aen1_zong,0			
		 andlw        0f0h
		 movwf        lcdtemp1 
		 swapf        lcdtemp1 
		 call         get7seg
		 movwf        bcd4
	         bsf          bcd4,4
	
	         movf         aen2_zong,0 
	         andlw        0fh
		 movwf        lcdtemp1
		 call         get7seg
		 movwf        bcd3
;		 bsf          bcd3,4
		 movf         aen2_zong,0			
		 andlw        0f0h
		 movwf        lcdtemp1 
		 swapf        lcdtemp1 
	  	 call         get7seg
		 movwf        bcd2

		 movf         aen3_zong,0 
	         andlw        0fh
		 movwf        lcdtemp1
		 call         get7seg
		 movwf        bcd1
		 movf         aen3_zong,0			
		 andlw        0f0h
		 movwf        lcdtemp1 
		 swapf        lcdtemp1 
		 call         get7seg
		 movwf        bcd5
	     
	         movf         aen4_zong,0 
	         andlw        0fh
		 movwf        lcdtemp1
		 call         get7seg
		 movwf        bcd6 
		 movf         bcd6,0 
	         xorlw        0afh
		 btfss        status,2
		 goto         writelcd
		 clrf         bcd6
		 movf         bcd5,0
		 xorlw        0afh
		 btfss        status,2
		 goto         writelcd
		 clrf         bcd5
		 movf         bcd1,0
		 xorlw        0afh
		 btfss        status,2
		 goto         writelcd
		 clrf         bcd1
		 movf         bcd2,0
		 xorlw        0afh
		 btfss        status,2
		 goto         writelcd
		 clrf         bcd2 
writelcd     
               bcf          ht1621_cs
               call         write_lcd101
               movlw        .28
	       call         write_addr
	       swapf        bcd5
	       swapf        bcd6
	       movlw        .2
	       movwf        r0
	       movlw        bcd6
	       movwf        fsr
	       call         write_lcddata
	       bsf          ht1621_cs
             nop 

	       bcf          ht1621_cs
	       call         write_lcd101
	       movlw        0
	       call         write_addr   
	       movlw        .4
	       movwf        r0
	       movlw        bcd4
	       movwf        fsr
	       call         write_lcddata
	       bsf          ht1621_cs
               nop
               bsf          status,5
               btfsc        flag_display,5
               goto         display_kwh
               btfsc        flag_display,6
               goto         display_kwh
               btfsc        flag_display,2
               goto         display_kwh
               btfsc        flag_display,1
               goto         display_kwh
               bcf          status,5
	         bcf          ht1621_cs
               call         write_lcd101
               movlw        .22
	       call         write_addr
	       movlw        83h
	       movwf        bcd1
	       movlw        .1
	       movwf        r0
	       movlw        bcd1
	       movwf        fsr
	       call         write_lcddata
	       bsf          ht1621_cs 
	       retlw        0  
display_kwh
               bcf          status,5
               bcf          ht1621_cs
               call         write_lcd101
               movlw        .22
	       call         write_addr
	       movlw        00h
	       movwf        bcd1
	       movlw        .1
	       movwf        r0
	       movlw        bcd1
	       movwf        fsr
	       call         write_lcddata
	       bsf          ht1621_cs 
	       retlw        0  
;----------------------------------------------
write_lcddata
	  	   movf         indf,0
		   movwf        lcdtemp1 
		   movlw        .8
		   movwf        r2
lcd_dataz
	           bcf          status,0
	           bcf          ht1621_wr
	           rrf          lcdtemp1
		   btfsc        status,0
		   goto         $+3
		   bcf          ht1621_data 
		   goto         $+2
		   bsf          ht1621_data 
		   bsf          ht1621_wr
		   decfsz       r2
		   goto         lcd_dataz
		   decf         fsr
		   decfsz       r0
		   goto         write_lcddata
		   retlw        0
;-------------------------------------- 
write_lcd100
         bcf           ht1621_cs
         bsf           ht1621_wr
         bsf           ht1621_data 
         movlw         80h             
         movwf         lcdtemp1
         movlw         03
         movwf         r0
lcd_data100
           bcf           status,0
           bcf           ht1621_wr
	     rlf           lcdtemp1
	     btfsc         status,0
	     goto          $+3
	     bcf           ht1621_data 
	     goto          $+2
	     bsf           ht1621_data 
	     goto          $+1
           bsf           ht1621_wr

⌨️ 快捷键说明

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