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

📄 h.asm

📁 M62446的源代码
💻 ASM
📖 第 1 页 / 共 5 页
字号:
;
;;                                                                                    
                  LIST      R=DEC, COLUMNS=120, XREF=YES, NOWRAP,LINES=0
;
                  include    "PIC16c73.inc"
;
offset           EQU 0x20
count            EQU 0x21
count1           EQU 0x22
count2           EQU 0x23
count3           EQU 0x24
count4           EQU 0x25
rxdata           EQU 0x26
rcount           EQU 0x27
rcvreg           EQU 0x28
dlycnt           EQU 0x29
temp0            EQU 0x2a
temp1            EQU 0x2b 
;spicount        EQU 0x2c
flag             EQU 0x2c
cencount         EQU 0x2d
scount           EQU 0x2e
swcount          EQU 0x2f 
lcount           EQU 0x53
rrcount          EQU 0x54
intintcount      EQU 0x55 
intcount         EQU 0x56 
intcountt        EQU 0x57
mutecount        EQU 0x58
testcount        EQU 0x59
txbuf            EQU 0x5a  
tcount           EQU 0x5b 
delaycount       EQU 0x5c 
dspcount         EQU 0x5d
cenmodecount     EQU 0x5e
msd              EQU 0x5f
lsd              EQU 0x60
vflag            EQU 0x61
txbuf1           EQU 0x62 
txbuf2           EQU 0x63
txbuf3           EQU 0x64
testoncount      EQU 0x65
dbflag           EQU 0x66
inflag           EQU 0x67
testch           EQU 0x68  
adover           EQU 7
adcount          EQU 0x69 
tremcount        EQU 0x6a 
tremcount1       EQU 0x6b
basscount        EQU 0x6c
basscount1       EQU 0x6d
remocount        EQU 0x6e
xsflag           EQU 0x7f
loudcount        EQU 0x74
balancount       EQU 0x75
balan2count      EQU 0x76
dyflag           EQU 0x77 
muteflag         EQU 0x78
pinflag1         EQU 0x79
pinflag2         EQU 0x7a           ;pinflag1: 0 live 1 rock 2 disco 3 simul  
datareg          EQU 0x7b           ; 4 matr 5 clas 6 hall 7 pops
x                EQU 0x7c           ; pinflag2: 0stereo 1 direct    
y                EQU 0x7d 
dispcount        EQU 0x7e 



reg1             EQU 0x30  
reg2             EQU 0x31
reg3             EQU 0x32
reg4             EQU 0x33
reg5             EQU 0x34
reg6             EQU 0x35
reg7             EQU 0x36
reg8             EQU 0x37 
reg9             EQU 0x38  
reg10            EQU 0x39
reg11            EQU 0x3a
reg12            EQU 0x3b
reg13            EQU 0x3c
reg14            EQU 0x3d
reg15            EQU 0x3e
reg16            EQU 0x3f

sreg1            EQU 0x40  
sreg2            EQU 0x41
sreg3            EQU 0x42
sreg4            EQU 0x43
sreg5            EQU 0x44
sreg6            EQU 0x45
sreg7            EQU 0x46
sreg8            EQU 0x47 
sreg9            EQU 0x48  
sreg10           EQU 0x49
sreg11           EQU 0x4a
sreg12           EQU 0x4b
sreg13           EQU 0x4c
sreg14           EQU 0x4d
sreg15           EQU 0x4e
sreg16           EQU 0x4f

#define stb portc,2 

           ORG 0

         goto START       

           ORG 4              
           goto iintser                                                                  
           ORG 0x10  

shuju      macro xy  
           movlw 3 
           addwf xy,0  
           movwf datareg
           rlf datareg,0 
           ENDM


output1  
           movwf sspbuf		
M8         bsf _rp0  
           btfss sspstat,0
           goto M8    
           bcf _rp0
           movf sspbuf,w
           movwf rxdata
           return
orderen1
           bsf stb
           nop
           bcf stb      
           return
  


disp_off11 movlw 48
           movwf count4 
           call orderen1 
           movlw b'00000011'
           call output1
           bcf stb  
           goto X13  
X13        movlw 0x00
           call output1
           decfsz count4,1
           goto X13
           return  
delay40    movlw 0x20
           goto to1

delay20   
           movlw 0x40
           goto to1
delayfa1
           movlw 0xfa 
to1        movwf temp0
           clrf temp1
X10        incfsz temp1,1
           goto X10
           decfsz temp0,1
           goto X10
           return 

                                                     
dispon1  
           call orderen1
           movlw b'11110001'                               
           return

           call output1
output595  bcf portb,4   ;sck 
           bcf portb,3   ;Rck                                                                                                               
           nop
           rrf txbuf,1
           btfss _c           
           goto t5951
           bsf portb,5       ;bit is 1
           goto t5952
t5951      bcf portb,5       ;bit is 0
t5952      nop           
           bsf portb,4
           nop        
           decfsz tcount,1
           goto output595
           bsf portb,3 
           nop
           return

m62446 
          call volhl
          movf txbuf1,0
          movwf txbuf 
          movlw 7
          movwf tcount
          call outputvol  
          movf txbuf2,0
          movwf txbuf 
          movlw 7
          movwf tcount
          call outputvol
          movf txbuf3,0
          movwf txbuf 
          movlw 2
          movwf tcount
          call outputvol
          call vollh
          return 

volhl     bcf _rp0
          bsf porta,1
          call delay8u 
        ; bcf porta,3
          bcf porta,1
          return    
vollh     bcf porta,1 
         ;bcf porta,3
          call delay8u 
          bsf porta,1
          return  
           
outputvol                   ;porta,3 clk porta,2 data porta,1 lata
p3        bcf porta,3
          bcf _c
          call delay10u
          rlf txbuf,1
          btfss _c           ;bit is 1  
          goto tvol1
          bsf porta,2
          goto tvol2
tvol1     bcf porta,2       ;bit is 0
tvol2     nop          
          bsf porta,3
          call delay10u
          decfsz tcount,1
          goto p3
          return
addelay
          movlw 10
          goto p1
delay100
          movlw 100
          goto p1
delay30   
          movlw 20
          goto p1  
delay36   
          movlw 36
          goto p1 
delay18   movlw 18
          goto p1

delay60
          movlw 60
          goto p1
delay8u
          movlw 5 
          goto p1
delay10u
          movlw 8
          goto p1
p1        movwf  dlycnt
p2        decfsz dlycnt,1
          goto p2            
          return     
reseten   
          bcf _rp0  
          bcf portb,6
          bsf portb,6
          call delay100    ;100us       ;reset
          bcf portb,6 
          bsf portb,7   ;;;;;;;;;;
          call delay30     ;30us   
          bcf portb,7 
          call delay36
          return
stren 
          bcf _rp0
          bsf portb,7                 ;strobe
          call delay18
          bcf portb,7 
          call delay36;;;;
          return
njw1102 
          call reqhl
          movf txbuf1,0 
          movwf txbuf
          movlw 8
          movwf  tcount
          call outputnjw 
          movf txbuf2,0
          movwf txbuf
          movlw 4          ;ID CODE
          movwf tcount
          call outputnjw
          call reqlh
          return
          
outputnjw
njw       bsf portb,4         ;portb ,4 sck 5,data 2.req
          bcf _c 
          nop
          rlf txbuf,1
          btfss _c
          goto njw1
          bsf portb,5 
          goto njw2
njw1      bcf portb,5
njw2      nop
          bcf portb,4 
          nop
          decfsz tcount,1
          goto njw
          return

reqhl     bsf portb,2 
          nop  
          bsf portb,4
          bcf portb,2
          return   

reqlh     bcf portb,2 
          bsf portb,4 
          nop
          bsf portb,2
          return
  



                   
START    
  
           bcf   _rp0
           clrf  portc          ; PORTC口初始化
           clrf porta
           clrf portb  
           bsf _rp0 
            
           movlw b'00000111'  
           movwf adcon1
           movlw b'10010001'
           movwf  trisc 
           movlw b'11110001'         
           movwf trisa
           movlw b'00000011'
           movwf trisb 
           bcf _rp0 
           
           movlw b'00110001'    ;spi module*          
           movwf  sspcon
;vfd       
           call orderen1  
           movlw  b'00110000'   ;SET DISPLAY MODE:13DIGITS,15SEGMENTS
           call  output1
           call orderen1            
           movlw b'00000010'    ;写数据到DISPLAY MEMORY 模式     
           call output1 
           call orderen1        ;nintaus         
           movlw b'00000011'
           call output1
           bcf stb 
           call disp_off11 
          ; bsf pclath ,3  
            bsf pclath,3    
            call mutenjw
            bsf pclath,3
           call iidata  
           bsf pclath ,3
           call initnm 
           bsf pclath,3
           call nintdisp  
           call bigdelay
           call disp_off1
           bsf pclath ,3
           call n3800disp 
           call iidata
           bcf pclath,3  
           call stereo  
            bsf pclath,3
           call vcd 
            bcf pclath,3
           clrf pir1
           movlw b'11010000'
           movwf intcon               ;Global interrut enable
           bsf _rp0
           movlw b'00000001'          ;Timer1 interrupt enable bit
           movwf pie1 
           movlw b'10000000'           ;FALL ELAGE
           movwf optionr   
           bcf _rp0
           movlw 0xfb
           movwf tmr1h                ;set high 8bit
           movlw 0xf0
           movwf tmr1l                ;set low8bit
           movlw b'00000001'          ;enables timer1,internal clock(osc/4)
           movwf t1con      
           bsf portb,0
          
        
;initilize ad: 

             
             bsf _rp0
             clrf adcon1
             bsf pie1,6
             bcf _rp0
             movlw b'11000001'
             movwf adcon0
             bcf pir1,6
             bsf intcon,6
             bsf intcon,7 
             bcf _rp0 
             clrf portb  ;;;;;;
             call reseten
            ;call stren 
             clrf adcount  
convert      
             bcf _rp0
             bsf intcon,6
             call addelay
             bcf pir1,6
             bsf adcon0,2 
             bsf intcon,7           
            

loop         btfss pir1,6
             goto convert
             goto loop



adintser  
            bcf _adif 
            movf testcount,0
            xorlw 1
            btfsc _z 
            return
            
            incf adcount,1
            movf adcount,0
            xorlw 1
            btfsc _z     ;=1?
            goto N1      ;yes 
            movf adcount,0
            xorlw 2
            btfsc _z
            goto N2 
            movf adcount,0
            xorlw 3
            btfsc _z
            goto N3 
            movf adcount,0
            xorlw 4
            btfsc _z
            goto N4 
            movf adcount,0
            xorlw 5
            btfsc _z
            goto N5
            return   


N1          call orderen1
            movlw b'00110011'
            call output1                     ;g5  
            goto NNN
            
N2          call orderen1
            movlw b'10010011'
            call output1                       ;g4    
            goto NNN
           
N3          call orderen1
            movlw b'01100011'
            call output1 
            movf adres,0          ;100HZ      ;g3
            goto NNN
            

N4          call orderen1
            movlw b'11000011'
            call output1                          ;g2   
            goto NNN
           
N5          call orderen1
            movlw b'00000011'
            call output1  
            clrf adcount 
            bcf portb,6 
            movf adres,0          ;100HZ          ;g1
            call bbg
            call reseten 
            return 

NNN         movf adres,0          ;100HZ          ;g1
            call bbg
            call stren                     
            return 
                                                                       
bbg         sublw 20             ;yes
            btfsc _c             ;carry ?    
            goto b0               ; no   
            movf adres,0            	
            sublw 50               ;yes
            btfsc _c             ;carry ?
            goto b1               ; no  
            movf adres,0
            sublw 80              ;yes
            btfsc _c             ;carry ?
            goto b2               ; no 
            movf adres,0
            sublw 90              ;yes
            btfsc _c             ;carry ?
            goto b3               ; no 
            movf adres,0
            sublw 130              ;yes
            btfsc _c             ;carry ?
            goto b4               ; no  
            movf adres,0
            sublw 160              ;yes
            btfsc _c             ;carry ?
            goto b5               ; no  
            movf adres,0
            sublw 180              ;yes
            btfsc _c             ;carry ?
            goto b6                  
            movf adres,0
            sublw 202              ;yes
            btfsc _c             ;carry ?
            goto b7               ; no  
            movf adres,0
            sublw 255              ;yes
            btfsc _c             ;carry ?
            goto b8               ; no
            return  

b0           movlw 0x00  
             goto pinpu
             
b1           btfsc xsflag,7 
             goto w1
             movlw 0x01 
             goto pinpu
w1           movlw 0x08
             goto pinpu

b2           btfsc xsflag,7 
             goto w3
             movlw 0x03
             goto pinpu
w3           movlw 0x18
             goto pinpu    

b3           btfsc xsflag,7 

⌨️ 快捷键说明

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