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

📄 main.s

📁 cypress的触摸按键模块介绍calibrating_capsense_with_the_csr_user_module___an2355_13.
💻 S
字号:
	.module main.c
	.area data(ram, con, rel)
_dacCurrent::
	.blkb 2
	.area idata
	.byte 44,42
	.area data(ram, con, rel)
	.blkb 2
	.area idata
	.byte 36,35
	.area data(ram, con, rel)
	.blkb 2
	.area idata
	.byte 32,30
	.area data(ram, con, rel)
	.blkb 2
	.area idata
	.byte 34,38
	.area data(ram, con, rel)
	.dbfile ./main.h
	.dbsym e dacCurrent _dacCurrent A[8:8]c
_scanSpeed::
	.blkb 2
	.area idata
	.byte 30,29
	.area data(ram, con, rel)
	.dbfile ./main.h
	.blkb 2
	.area idata
	.byte 25,14
	.area data(ram, con, rel)
	.dbfile ./main.h
	.blkb 2
	.area idata
	.byte 10,10
	.area data(ram, con, rel)
	.dbfile ./main.h
	.blkb 2
	.area idata
	.byte 12,13
	.area data(ram, con, rel)
	.dbfile ./main.h
	.dbsym e scanSpeed _scanSpeed A[8:8]c
_prev_buttons::
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile ./main.h
	.dbsym e prev_buttons _prev_buttons c
	.area text(rom, con, rel)
	.dbfile ./main.h
	.dbfunc e Setup_IO _Setup_IO fV
;              i -> X+0
_Setup_IO::
	.dbline -1
	push X
	mov X,SP
	add SP,2
	.dbline 28
; //----------------------------------------------------------------------------
; // Cap Touch code for Application Note
; //
; // Author:	Darrin Vallis
; //----------------------------------------------------------------------------
; 
; #include <m8c.h>        					// part specific constants and macros
; #include "PSoCAPI.h"    					// PSoC API definitions for all User Modules
; #include "main.h"
; 
; void main()
; {	
; 	Setup_IO();								//Set up GPIO for address inputs
; 	Setup_I2C();							//Configure and start I2C engine
; 	Setup_Touch();							//Configure cap touch	
; 	M8C_EnableGInt;							//Start everything
; 					
;     while(1)
;     {
;     	Scan_Buttons();						//Switch data in *SENSE_baSwOnMask	
; 		Set_LEDS();							//Turn on LEDs
; 		Set_Interrupt_Pin();				//Set or clear int pin
; 	}	
; }
; }
; }
; }
; }
	.dbline 32
; }
; }
; }
; }
	mov REG[0x8],-1
	.dbline 33
; }
	mov [_I2Cregs+1],0
	.dbline 37
; }
; }
; }
; }
	or REG[0x7],-96
	.dbline 38
; }
	or F,0x10  ; iopage = 1
	or REG[0x5],-96
	.dbline 39
; }
	or REG[0x4],-96
	and F,0xEF ; iopage = 0
	.dbline 42
; }
; }
; }
	or REG[0x4],16
	.dbline 45
; }
; }
; }
	mov [_I2Cregs],0
	.dbline 46
; }
	and [_I2Cregs],-2
	.dbline 51
; }
; }
; }
; }
; }
	or REG[0x4],72
	.dbline -2
	.dbline 52
; }
L1:
	add SP,-2
	pop X
	.dbline 0 ; func end
	ret
	.dbsym l i 0 I
	.dbend
	.dbfunc e Setup_I2C _Setup_I2C fV
;      I2Cstatus -> X+2
;       PortData -> X+1
;        I2Caddr -> X+0
_Setup_I2C::
	.dbline -1
	push X
	mov X,SP
	add SP,7
	.dbline 55
; }
; }
; }
	.dbline 65
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
	or REG[0x4],72
	.dbline 66
; }
	mov A,REG[0x4]
	mov [X+1],A
	.dbline 67
; }
	mov [X+0],64
	.dbline 68
; }
	tst [X+1],8
	jz L5
	mov A,[X+0]
	or A,1
	mov [X+4],A
	mov [X+3],0
	xjmp L6
L5:
	mov A,[X+0]
	mov [X+4],A
	mov [X+3],0
L6:
	mov A,[X+4]
	mov [X+0],A
	.dbline 69
; }
	tst [X+1],64
	jz L8
	mov A,[X+0]
	or A,2
	mov [X+6],A
	mov [X+5],0
	xjmp L9
L8:
	mov A,[X+0]
	mov [X+6],A
	mov [X+5],0
L9:
	mov A,[X+6]
	mov [X+0],A
	.dbline 71
; }
; }
	push X
	xcall _I2C_Start
	pop X
	.dbline 72
; }
	push X
	mov A,[X+0]
	xcall _I2C_SetAddr
	.dbline 74
; }
; }
	mov A,>_I2Cregs
	push A
	mov A,<_I2Cregs
	push A
	mov A,6
	push A
	mov A,3
	push A
	xcall _I2C_SetRamBuffer
	add SP,-4
	pop X
	.dbline 77
; }
; }
; }
	or [_I2Cregs],4
	.dbline 78
; }
	mov [_I2Cregs+2],0
	.dbline -2
	.dbline 79
; }
L3:
	add SP,-7
	pop X
	.dbline 0 ; func end
	ret
	.dbsym l I2Cstatus 2 c
	.dbsym l PortData 1 c
	.dbsym l I2Caddr 0 c
	.dbend
	.dbfunc e Setup_Touch _Setup_Touch fV
_Setup_Touch::
	.dbline -1
	.dbline 82
; }
; }
; }
	.dbline 83
; }
	push X
	xcall _SENSE_Start
	pop X
	.dbline 85
; }
; }
	mov [_SENSE_baBtnFThreshold],80
	.dbline 86
; }
	mov [_SENSE_baBtnFThreshold+1],100
	.dbline 87
; }
	mov [_SENSE_baBtnFThreshold+2],100
	.dbline 88
; 
	mov [_SENSE_baBtnFThreshold+3],90
	.dbline 89
; 
	mov [_SENSE_baBtnFThreshold+4],90
	.dbline 90
; 
	mov [_SENSE_baBtnFThreshold+5],100
	.dbline 91
; 
	mov [_SENSE_baBtnFThreshold+6],100
	.dbline 92
; 
	mov [_SENSE_baBtnFThreshold+7],100
	.dbline -2
	.dbline 93
; 
L11:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e Scan_Buttons _Scan_Buttons fc
;         status -> X+1
;              i -> X+0
_Scan_Buttons::
	.dbline -1
	push X
	mov X,SP
	add SP,2
	.dbline 96
; 
; 
; 
	.dbline 99
; 
; 
; 
	mov [X+0],0
	xjmp L23
L20:
	.dbline 100
; 
	.dbline 101
; 
	push X
	mov A,0
	push A
	mov A,[X+0]
	mov [__r1],A
	mov [__r0],0
	add [__r1],<_dacCurrent
	adc [__r0],>_dacCurrent
	mvi A,[__r1]
	pop X
	xcall _SENSE_SetDacCurrent
	pop X
	.dbline 102
; 
	mov A,[X+0]
	mov [__r1],A
	mov [__r0],0
	add [__r1],<_scanSpeed
	adc [__r0],>_scanSpeed
	mvi A,[__r1]
	push X
	xcall _SENSE_SetScanSpeed
	pop X
	.dbline 103
; 
	push X
	mov A,0
	push A
	mov A,1
	push A
	mov A,[X+0]
	push A
	xcall _SENSE_StartScan
	add SP,-3
	pop X
L24:
	.dbline 104
L25:
	.dbline 104
	push X
	xcall _SENSE_GetScanStatus
	pop X
	mov [__r0],A
	tst [__r0],32
	jz L24
	.dbline 110
L21:
	.dbline 99
	inc [X+0]
L23:
	.dbline 99
	cmp [X+0],8
	jc L20
X0:
	.dbline 111
; 
; 
; 
; 
; 
; 
; 
; 
	push X
	mov A,0
	xcall _SENSE_bUpdateBaseline
	pop X
	mov [X+1],A
	.dbline 113
; 
; 
	mov A,[_SENSE_baSwOnMask]
	cmp A,[_prev_buttons]
	jz L27
	.dbline 113
	mov [_prev_buttons],[_SENSE_baSwOnMask]
L27:
	.dbline 115
; 
; 
	mov A,[X+1]
	.dbline -2
L19:
	add SP,-2
	pop X
	.dbline 0 ; func end
	ret
	.dbsym l status 1 c
	.dbsym l i 0 c
	.dbend
	.dbfunc e Set_Interrupt_Pin _Set_Interrupt_Pin fV
_Set_Interrupt_Pin::
	.dbline -1
	push X
	mov X,SP
	add SP,2
	.dbline 119
; 
; 
; 
; 
	.dbline 120
; 
	mov A,[_SENSE_baSwOnMask]
	cmp A,[_prev_buttons]
	jz L30
	.dbline 121
; 
	.dbline 122
; 
	tst [_I2Cregs],1
	jnz L32
	.dbline 123
; 
	.dbline 124
; 
	or [_I2Cregs],-128
	.dbline 125
; 
	tst [_I2Cregs],2
	jz L35
	mov A,REG[0x4]
	or A,16
	mov [X+1],A
	mov [X+0],0
	xjmp L36
L35:
	mov A,REG[0x4]
	and A,-17
	mov [X+1],A
	mov [X+0],0
L36:
	mov A,[X+1]
	mov REG[0x4],A
	.dbline 126
; 
L32:
	.dbline 127
; 
L30:
	.dbline 129
; 
; 
	push X
	xcall _I2C_GetActivity
	pop X
	mov [__r0],A
	tst [__r0],32
	jz L37
	.dbline 130
; 
	.dbline 131
; 
	and [_I2Cregs],127
	.dbline 132
; 
	tst [_I2Cregs],2
	jz L40
	mov A,REG[0x4]
	and A,-17
	mov [X+1],A
	mov [X+0],0
	xjmp L41
L40:
	mov A,REG[0x4]
	or A,16
	mov [X+1],A
	mov [X+0],0
L41:
	mov A,[X+1]
	mov REG[0x4],A
	.dbline 133
L37:
	.dbline -2
	.dbline 134
; 
; 
L29:
	add SP,-2
	pop X
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e Set_LEDS _Set_LEDS fV
_Set_LEDS::
	.dbline -1
	.dbline 137
; 
; 
; 
	.dbline 138
; 
	mov A,[_SENSE_baSwOnMask]
	mov REG[0x8],A
	.dbline -2
	.dbline 139
; 
L42:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfile ./main.c
	.dbfunc e main _main fV
_main::
	.dbline -1
	.dbline 12
	.dbline 13
	xcall _Setup_IO
	.dbline 14
	xcall _Setup_I2C
	.dbline 15
	xcall _Setup_Touch
	.dbline 16
		or  F, 01h

	xjmp L45
L44:
	.dbline 19
	.dbline 20
	xcall _Scan_Buttons
	.dbline 21
	xcall _Set_LEDS
	.dbline 22
	xcall _Set_Interrupt_Pin
	.dbline 23
L45:
	.dbline 18
	xjmp L44
X1:
	.dbline -2
	.dbline 24
L43:
	.dbline 0 ; func end
	jmp .
	.dbend
	.area bss(ram, con, rel)
	.dbfile ./main.c
_I2Cregs::
	.blkb 3
	.dbfile ./main.h
	.dbsym e I2Cregs _I2Cregs X

⌨️ 快捷键说明

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