yinxiang.asm

来自「IPOD 音响 主要是将IPOD 音乐通过 功放放大」· 汇编 代码 · 共 750 行 · 第 1/2 页

ASM
750
字号
	mov	a,basscount
	movc	a,@a+dptr
	anl	a,#0fh
	orl	a,datatemp
	mov	i2csenddata,a
	call	sendata
treblemius_2:
	call	losekey
	jb	status.1,treblemius_2; no losekey go on
	jmp	exit
;=========================================
bassadd:
	mov	module,#0ch
	mov	dptr,#TONEtab
	mov	a,basscount
	cjne	a,#0,bassadd_1
	jmp	bassadd_2
bassadd_1:
	dec	basscount
	mov	a,basscount
	movc	a,@a+dptr
	mov	datatemp,a
	mov	a,trblecount
	movc	a,@a+dptr
	swap	a
	anl	a,#0fh
	orl	a,datatemp
	mov	i2csenddata,a
	call	sendata
bassadd_2:
	call	losekey
	jb	status.1,bassadd_2; no losekey go on
	jmp	exit
;========================================
bassmius:
	mov	module,#0ch
	mov	dptr,#TONEtab
	mov	a,basscount
	cjne	a,#13,bassmius_1
	jmp	bassmius_2
bassmius_1:
	inc	basscount
	mov	a,basscount
	movc	a,@a+dptr
	mov	datatemp,a
	mov	a,trblecount
	movc	a,@a+dptr
	swap	a
	anl	a,#0fh
	orl	a,datatemp
	mov	i2csenddata,a
	call	sendata
bassmius_2:
	call	losekey
	jb	status.1,bassmius_2; no losekey go on
	jmp	exit
;===========================================
voladd:
	cpl	powerled
	mov	module,#03
	mov	dptr,#VOLTAB
	mov	a,volcount
	cjne	a,#0,voladd_1
	jmp	voladd_2
voladd_1:
	dec	volcount
	mov	a,volcount
	movc	a,@a+dptr
	anl    a,#7fh
	mov	i2csenddata ,a
	mov	i2ctime,#8
	call	sendata
      ;  call    delay20ms
voladd_2:
	call	losekey
	jb	status.1,voladd; no losekey go on
	jmp	exit
;======================================VOLMIUS
VOLMius:
	cpl	powerled
	mov	module,#03h
	mov	dptr,#VOLTAB
	mov	a,volcount
	cjne	a,#80,VOLMius_1
	jmp	VOLMius_2
VOLMius_1:
	inc	volcount
	mov	a,volcount
	movc	a,@a+dptr
        anl    a,#7fh
	mov	i2csenddata,a
	mov	i2ctime,#8
	call	sendata
VOLMius_2:
	call	losekey
	jb	status.1,VOLMius; no losekey go on
	jmp	exit
;-----------------------------------------------
;========================================NEXTTRACK
NEXTTRACK:
	mov	dptr,#nexttracktab
	call	simplesend
NEXTTRACK_1:
	jmp	exit
;======================================PRETRACK
PRETRACK:
	mov	dptr,#pretracktab
	call	simplesend
PRETRACK_1:
	jmp	exit
;----------------------------------------
PLAYPAUSE:
	mov	dptr,#playpausetab
	call	simplesend
PLAYPAUSE_1:
	jmp	exit
;----------------------------
uparrow:
	mov	dptr,#uparrowtab
	call	simplesend
	jmp	exit
;========================================
downarrow:
	mov	dptr,#downarrowtab
	call	simplesend
	jmp	exit
;------------------------
menu:
	mov	dptr,#menutab
	call	simplesend
	jmp	exit
;-------------------------------
select:
	mov	dptr,#selecttab
	call	simplesend
	jmp	exit
;**************************************************** remote status end
;***************************************************i2c program
sendata:
         CLR         bErr
            CALL	START_I2C_PT
            MOV	        A,#80H    ;;;;;80H for 2315,088H for 2313.
            CALL	Send_I2C_Data_PT
            MOV	        A,module
            CALL	Send_I2C_Data_PT
            MOV	        A,i2csenddata
       ;     mov		a,#11101010B
            CALL	Send_I2C_Data_PT
            NOP
            CALL	STOP_I2C_PT
            RET
;---------------------------------------------
Send_I2C_Data_PT:
            MOV	     R2,#08H
SendPT10:   RLC	     A
            MOV	     SDA73,C
            MOV      R3,#1
            DJNZ     R3,$
            SETB     SCL73
            MOV      R3,#1
            DJNZ     R3,$
            CLR	     SCL73
            DJNZ     R2,SendPT10
            MOV      R3,#1
            DJNZ     R3,$
            SETB     SDA73
            MOV      R3,#1
            DJNZ     R3,$
            SETB     SCL73
            MOV      R3,#1
            DJNZ     R3,$
;           MOV      R3,#050H
SendPT12:   MOV      R2,#01H
SendPT11:   JNB	     SDA73,ACKEDPT
            DJNZ     R2,SendPT11
;           DJNZ     R3,Send12
            CLR      SCL73
            SETB     bErr
            RET
ACKEDPT:    CLR	     SCL73
	ret
;---------------------------------
START_I2C_PT:
            CLR	      SCL73
            MOV       R3,#1
            DJNZ      R3,$
            SETB      SDA73
            MOV       R3,#1
            DJNZ      R3,$
            SETB      SCL73
            MOV       R3,#1
            DJNZ      R3,$
            CLR	      SDA73
            MOV       R3,#1
            DJNZ      R3,$
            CLR	      SCL73
            RET
;---------------------------
 STOP_I2C_PT:
            CLR	      SCL73
            MOV       R3,#1
            DJNZ      R3,$
            CLR	      SDA73
            MOV       R3,#1
            DJNZ      R3,$
            SETB      SCL73
            MOV       R3,#1
            DJNZ      R3,$
            SETB      SDA73
            MOV       R3,#1
            DJNZ      R3,$
            CLR	      SCL73
            RET
;--------------------------
 ACKI:
      call	dly
      SETB  scl73
      call	dly
      clr	scl73
      call	dly
      setb	sda73
      mov	c,sda73
ACK_1:
      LCALL dly
       LCALL dly
        LCALL dly
        LCALL dly
      MOV   C,sda73
   ; JC     ACK_1
    call	dly
     setb	scl73
      RET
;---------------------------
 ACKO:SETB   scl73
     LCALL   dly
     MOV     sda73,C
     CLR     scl73
     RET
;===================================================================== IPOD 程序
simplesend:
	mov	count,#00h
simplesend_1:
	mov	a,count
	movc	a,@a+dptr
	inc	count
	cjne	a,#88h,simplesend_2
	call	losekey
	jb	status.1,simplesend; no losekey go on
;----------------------------------- losekey exit
	mov	count,#00h
simplesend_1_1:
	mov	a,count
	mov	dptr,#buttomuptab
	movc	a,@a+dptr
	inc	count
	cjne	a,#88h,simplesend_3
	ret
;--------------------------------
simplesend_2:
	mov	sbuf, a
	clr     ti
	jnb	ti,$
        jmp	simplesend_1
 ;------------------------------
simplesend_3:
	mov	sbuf, a
	clr     ti
	jnb	ti,$
        jmp	simplesend_1_1
;=======================================================================; delay programm
delay3s:
	mov	r7,#200
delay3s_1:
	mov	r6,#150
delay3s_2:
	mov	r5,#50
	djnz	r5,$
	djnz	r6,delay3s_2
	djnz	r7,delay3s_1
	ret
;------------------------------
delay100ms:
	mov	r7,#200
	jmp	delay
delay80ms:
	mov	r7,#160
	jmp	delay
delay20ms:
	 mov 	r7,#40
	 jmp	delay
delay10ms:
           mov 	r7,#20
delay:
	mov	r6,#250
	djnz	r6,$
	djnz	r7,delay
	ret
;------------------------
dly:
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	ret
;----------------------------------------------------------------; 初始化 UART
iniuart:
	mov	tmod,#0afh
	setb	sm1
	clr	sm0
	mov	tl1,#0fdh
	mov	th1,#0fdh
	mov	pcon,#80h
	clr	es
	setb	tr1
	clr	ti
	ret
;----------------------------------------------------------------------------
clrram:
	mov	r0,#7fh
clrram_1:
	mov	@r0,#0
	djnz	r0,clrram_1
	ret
;-----------------------------
playpausetab:
	 db      0ffh,55h,03h,02h,00h,01h,0faH,88h;
voladdtab:
	 db      0ffh,55h,03h,02h,00h,02h,0f9H,88h;
volmiustab:
	 db      0ffh,55h,03h,02h,00h,04h,0f7H,88h;
nexttracktab:
	 db      0ffh,55h,03h,02h,00h,08h,0f3H,88h;
pretracktab:
	 db      0ffh,55h,03h,02h,00h,10h,0ebH,88h;
menutab:
	db	 0ffh,55h,05h,02h,00h,00h,00h,40h,0b9H,88h;
selecttab:
	db	 0ffh,55h,05h,02h,00h,00h,00h,80h,79H,88h;
uparrowtab:
	db	 0ffh,55h,06h,02h,00h,00h,00h,00h,01h,0f7H,88h;
downarrowtab:
	db	 0ffh,55h,06h,02h,00h,00h,00h,00h,02h,0f6H,88h;
powerontab:
	db	  0ffh,55h,05h,02h,00h,00h,00h,02h,0f7H,88h;
shffletab:
	db	  0ffh,55h,04h,02h,00h,00h,80h,7aH,88h;
buttomuptab:
       db      0ffh,55h,03h,02h,00h,00h,0fbH,88h;
;=======================================================
VOLTAB:
	DB	11111111B,11011111B,11111110B,11011110B,11111101B,11011101B,11111100B,11011100B
	DB	11111011B,11011011B,11111010B,11011010B,11111001B,11011001B,11111000B,11011000B
	DB	11110111B,11010111B,11110110B,11010110B,11110101B,11010101B,11110100B,11010100B
	DB	11110011B,11010011B,11110010B,11010010B,11110001B,11010001B,11110000B,11010000B
	DB	11101111B,11001111B,11101110B,11001110B,11101101B,11001101B,11101100B,11001100B
	DB	11101011B,11001011B
	DB	11101010B,11001010B,10101010B,10001010B,11101001B,11001001B,10101001B,10001001B
	DB	11101000B,11001000B,10101000B,10001000B,11100111B,11000111B,10100111B,10000111B
	DB	11100110B,11000110B,10100110B,10000110B,11100101B,11000101B,10100101B,10000101B
	DB	11100100B,11000100B,10100100B,10000100B,11100011B,11000011B,10100011B,10000011B
	DB	11100010B,11000010B,10100010B,10000010B,11100001B,11000001B,10100001B,10000001B
	DB	11100000B,11000000B,10100000B,10000000B
TONEtab:
	DB	01100000B,01010000B,01000000B,00110000B,00100000B,00010000B,00000000B
	DB	10010000B,10100000B,10110000B,11000000B,11010000B,11100000B
	end

⌨️ 快捷键说明

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