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

📄 main.s

📁 此文件是一个源程序代码
💻 S
字号:
	cpu LMM
	.module main.c
	.area data(ram, con, rel)
_baseline0::
	.word 0
	.dbfile ./main.c
	.dbsym e baseline0 _baseline0 I
	.area data(ram, con, rel)
	.dbfile ./main.c
	.area data(ram, con, rel)
	.dbfile ./main.c
_baseline1::
	.word 0
	.dbsym e baseline1 _baseline1 I
	.area data(ram, con, rel)
	.dbfile ./main.c
	.area data(ram, con, rel)
	.dbfile ./main.c
_position::
	.word 0
	.dbsym e position _position I
	.area data(ram, con, rel)
	.dbfile ./main.c
	.area data(ram, con, rel)
	.dbfile ./main.c
_buttonselect::
	.word 0
	.dbsym e buttonselect _buttonselect I
	.area data(ram, con, rel)
	.dbfile ./main.c
	.area text(rom, con, rel)
	.dbfile ./main.c
	.dbfunc e main _main fV
_main::
	.dbline -1
	.dbline 17
; //----------------------------------------------------------------------------
; // C main line
; // Project to measure sensitivity on each switch
; // Output 3 switches timer data counts to LCD
; //----------------------------------------------------------------------------
; 
; #include <m8c.h>        // part specific constants and macros
; #include "PSoCAPI.h"    // PSoC API definitions for all User Modules
; 
; 
; 
; int baseline0 = 0;
; int baseline1 = 0;
; int position = 0;
; int buttonselect = 0;
; void main()
; {
	.dbline 18
; 	CSR_1_Start(); //Start the User modules
	push X
	xcall _CSR_1_Start
	.dbline 19
; 	LCD_1_Start();
	xcall _LCD_1_Start
	pop X
	.dbline 20
; 	M8C_EnableGInt; //Enable global interrupts
		or  F, 01h

	.dbline 21
; 	CSR_1_SetDacCurrent(0x80,0); //Set the DAC current to low range and 80h
	push X
	mov X,0
	mov A,-128
	xcall _CSR_1_SetDacCurrent
	.dbline 22
; 	CSR_1_SetScanSpeed(80); // Set the scan speed to 80
	mov A,80
	xcall _CSR_1_SetScanSpeed
	.dbline 23
; 	CSR_1_StartScan(0,11,1); // Scan 8 switches; starting switch 0; continously
	mov A,1
	push A
	mov A,11
	push A
	mov A,0
	push A
	xcall _CSR_1_StartScan
	add SP,-3
	.dbline 24
; 	LCD_1_Position(00,01);
	mov X,1
	mov A,0
	xcall _LCD_1_Position
	.dbline 25
; 	LCD_1_PrCString("PSoC CapSence  ");
	mov A,>L2
	push A
	mov A,<L2
	mov X,A
	pop A
	xcall _LCD_1_PrCString
	.dbline 26
; 	LCD_1_Position(01,06);
	mov X,6
	mov A,1
	xcall _LCD_1_Position
	.dbline 27
; 	LCD_1_PrCString("PTCC       ");
	mov A,>L3
	push A
	mov A,<L3
	mov X,A
	pop A
	xcall _LCD_1_PrCString
	pop X
	xjmp L5
X0:
	.dbline 30
; 		
; 	while(1) //Stay in this loop forever
; 	{
L7:
	.dbline 32
L8:
	.dbline 32
; 		//LCD_1_Position(00,00); 	//Set LCD position to row 0 and column 0
; 		while(!(CSR_1_GetScanStatus() & CSR_1_SCAN_SET_COMPLETE));	//Is scan complete?
	push X
	xcall _CSR_1_GetScanStatus
	mov REG[0xd0],>__r0
	pop X
	mov [__r0],A
	tst [__r0],32
	jz L7
	.dbline 33
; 		baseline0 =CSR_1_bUpdateBaseline(0);
	push X
	mov A,0
	xcall _CSR_1_bUpdateBaseline
	pop X
	mov REG[0xd0],>_baseline0
	mov [_baseline0+1],A
	mov [_baseline0],0
	.dbline 34
; 		baseline1 =CSR_1_bUpdateBaseline(1);
	push X
	mov A,1
	xcall _CSR_1_bUpdateBaseline
	pop X
	mov REG[0xd0],>_baseline1
	mov [_baseline1+1],A
	mov [_baseline1],0
	.dbline 37
; 		//This function returns a '1' if there was a finger present on any of the switches
; 		
; 		if (baseline0) // If a finger is detected,
	mov REG[0xd0],>_baseline0
	cmp [_baseline0],0
	jnz X2
	cmp [_baseline0+1],0
	jz L10
X2:
	.dbline 38
; 		{
	.dbline 39
; 				LCD_1_Position(00,00);
	push X
	mov A,0
	mov X,A
	xcall _LCD_1_Position
	pop X
	.dbline 40
; 				if (CSR_1_iaSwDiff[0] > 8) // Was it switch number 0?
	mov REG[0xd0],>_CSR_1_iaSwDiff
	mov A,8
	sub A,[_CSR_1_iaSwDiff+1]
	mov A,0
	sbb A,[_CSR_1_iaSwDiff]
	jnc L12
X3:
	.dbline 41
; 					{
	.dbline 43
; 						//LCD_1_PrHexByte(1); //Display '1'
; 						LCD_1_PrCString("-    Channel   +");
	push X
	mov A,>L14
	push A
	mov A,<L14
	mov X,A
	pop A
	xcall _LCD_1_PrCString
	pop X
	.dbline 45
; 						//LCD_1_PrHexInt(CSR_1_iaSwDiff[0]);
; 						buttonselect = 23;
	mov REG[0xd0],>_buttonselect
	mov [_buttonselect+1],23
	mov [_buttonselect],0
	.dbline 46
; 					}
	xjmp L13
L12:
	.dbline 47
; 				else if (CSR_1_iaSwDiff[1] > 8) // Was it switch number 1?
	mov REG[0xd0],>_CSR_1_iaSwDiff
	mov A,8
	sub A,[_CSR_1_iaSwDiff+2+1]
	mov A,0
	sbb A,[_CSR_1_iaSwDiff+2]
	jnc L15
X4:
	.dbline 48
; 					{
	.dbline 50
; 						//LCD_1_PrHexByte(2); //Display '2'
; 						LCD_1_PrCString("-    Volume    +");
	push X
	mov A,>L18
	push A
	mov A,<L18
	mov X,A
	pop A
	xcall _LCD_1_PrCString
	pop X
	.dbline 52
; 						//LCD_1_PrHexInt(CSR_1_iaSwDiff[1]);
; 						buttonselect = 25;
	mov REG[0xd0],>_buttonselect
	mov [_buttonselect+1],25
	mov [_buttonselect],0
	.dbline 53
; 					}
	xjmp L16
L15:
	.dbline 54
; 				else if (CSR_1_iaSwDiff[2] > 8) // Was it switch number 2?
	mov REG[0xd0],>_CSR_1_iaSwDiff
	mov A,8
	sub A,[_CSR_1_iaSwDiff+4+1]
	mov A,0
	sbb A,[_CSR_1_iaSwDiff+4]
	jnc L19
X5:
	.dbline 55
; 					{
	.dbline 57
; 						//LCD_1_PrHexByte(3); //Display '3'
; 						LCD_1_PrCString("-    Bright    +");
	push X
	mov A,>L22
	push A
	mov A,<L22
	mov X,A
	pop A
	xcall _LCD_1_PrCString
	pop X
	.dbline 59
; 						//LCD_1_PrHexInt(CSR_1_iaSwDiff[2]);
; 						buttonselect = 27;
	mov REG[0xd0],>_buttonselect
	mov [_buttonselect+1],27
	mov [_buttonselect],0
	.dbline 60
; 					}		
L19:
	.dbline 62
; 				else 
; 					{
	.dbline 64
; //						LCD_1_PrCString("None         ");
; 					}			
L20:
L16:
L13:
	.dbline 65
; 		}	
L10:
	.dbline 68
; 		
; 		
; 		if (baseline1 & buttonselect) // If a finger is detected,
	mov REG[0xd0],>_baseline1
	mov A,[_baseline1+1]
	mov REG[0xd0],>_buttonselect
	and A,[_buttonselect+1]
	mov REG[0xd0],>__r0
	mov [__r1],A
	mov REG[0xd0],>_baseline1
	mov A,[_baseline1]
	mov REG[0xd0],>_buttonselect
	and A,[_buttonselect]
	mov REG[0xd0],>__r0
	cmp A,0
	jnz X6
	cmp [__r1],0
	jz L23
X6:
	.dbline 69
; 		{		
	.dbline 74
; 		
; //			LCD_1_Position(01,00);
; 
; 			
; 			position = CSR_1_bGetCentroidPos(1); //Get finger position
	push X
	mov A,1
	xcall _CSR_1_bGetCentroidPos
	pop X
	mov REG[0xd0],>_position
	mov [_position+1],A
	mov [_position],0
	.dbline 75
; 			if (position!= 0xff) //Error condition check
	cmp [_position],0
	jnz X7
	cmp [_position+1],-1
	jz L25
X7:
	.dbline 76
; 			{
	.dbline 77
; 				LCD_1_Position(01,14);
	push X
	mov X,14
	mov A,1
	xcall _LCD_1_Position
	pop X
	.dbline 78
; 				LCD_1_PrHexByte(position); //Display the finger position
	mov REG[0xd0],>_position
	mov A,[_position+1]
	mov REG[0xd0],>__r0
	push X
	xcall _LCD_1_PrHexByte
	.dbline 79
; 				LCD_1_InitBG(LCD_1_SOLID_BG);
	mov A,0
	xcall _LCD_1_InitBG
	pop X
	.dbline 80
; 				LCD_1_DrawBG(01,00,14,position);
	mov REG[0xd0],>_position
	mov A,[_position+1]
	mov REG[0xd0],>__r0
	push X
	push A
	mov A,14
	push A
	mov A,0
	push A
	mov A,1
	push A
	xcall _LCD_1_DrawBG
	add SP,-4
	pop X
	.dbline 81
; 			}
L25:
	.dbline 82
; 		}
L23:
	.dbline 83
L5:
	.dbline 29
	xjmp L8
X1:
	.dbline -2
	.dbline 84
; 	} // End of normal operation loop
; } // End of main
L1:
	.dbline 0 ; func end
	jmp .
	.dbend
	.area lit(rom, con, rel)
L22:
	.byte 45,32,32,32,32,'B,'r,'i,'g,'h,'t,32,32,32,32,43
	.byte 0
L18:
	.byte 45,32,32,32,32,'V,'o,'l,'u,'m,'e,32,32,32,32,43
	.byte 0
L14:
	.byte 45,32,32,32,32,'C,'h,'a,'n,'n,'e,'l,32,32,32,43
	.byte 0
L3:
	.byte 'P,'T,'C,'C,32,32,32,32,32,32,32,0
L2:
	.byte 'P,'S,'o,'C,32,'C,'a,'p,'S,'e,'n,'c,'e,32,32,0

⌨️ 快捷键说明

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