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

📄 io.ls

📁 ST7LITE39 IIC功能应用实例,是一个完整的源程序
💻 LS
字号:
   1                     ; C Compiler for ST7 (COSMIC Software)
   2                     ; Generator V4.5.5 - 12 Jan 2006
 840                     .const:	section	.text
 841  0000               L364_PortAddr:
 842  0000 00            	dc.b	_PADR
 843  0001 03            	dc.b	_PBDR
 876                     ; 20 void IO_Init (void)
 876                     ; 21 {
 877                     	switch	.text
 878  0000               _IO_Init:
 881                     ; 22     PADDR = 0x00 ;
 883  0000 3f01          	clr	_PADDR
 884                     ; 23     PBDDR = 0x00 ;
 886  0002 3f04          	clr	_PBDDR
 887                     ; 24     PAOR  = 0x00 ;  
 889  0004 3f02          	clr	_PAOR
 890                     ; 25     PBOR  = 0x00 ;   
 892  0006 3f05          	clr	_PBOR
 893                     ; 26 }                                                        
 896  0008 81            	ret
1087                     ; 35 void IO_Input (IO_Input_Mode Input_Val, IO_Port Port_Val1, IO_Pin Pin_Val1)
1087                     ; 36 {                  
1088                     	switch	.text
1090                     	xref.b	_IO_Input$L
1091  0009               _IO_Input:
1093  0009 b701          	ld	_IO_Input$L+1,a
1094  000b bf00          	ld	_IO_Input$L,x
1096                     ; 39     PortDDR = (PortAddr[Port_Val1]+1) ;
1098  000d 97            	ld	x,a
1099  000e d60000        	ld	a,(L364_PortAddr,x)
1100  0011 4c            	inc	a
1101  0012 5f            	clr	x
1102  0013 b7fd          	ld	_IO_Input$L-3,a
1103  0015 bffc          	ld	_IO_Input$L-4,x
1104                     ; 41     *PortDDR &= (unsigned char)(~(unsigned char)( Pin_Val1)) ;
1106  0017 b602          	ld	a,_IO_Input$L+2
1107  0019 43            	cpl	a
1108  001a 92c4fc        	and	a,[_IO_Input$L-4.w]
1109  001d 92c7fc        	ld	[_IO_Input$L-4.w],a
1110                     ; 43     PortOR = (PortAddr[Port_Val1]+2);
1112  0020 be01          	ld	x,_IO_Input$L+1
1113  0022 d60000        	ld	a,(L364_PortAddr,x)
1114  0025 ab02          	add	a,#2
1115  0027 5f            	clr	x
1116  0028 b7ff          	ld	_IO_Input$L-1,a
1117  002a bffe          	ld	_IO_Input$L-2,x
1118                     ; 45     if (Input_Val == IO_FLOATING )
1120  002c 3d00          	tnz	_IO_Input$L
1121  002e 260b          	jrne	L116
1122                     ; 47         *PortOR &= (unsigned char)(~(unsigned char)( Pin_Val1 )) ;
1124  0030 b602          	ld	a,_IO_Input$L+2
1125  0032 43            	cpl	a
1126  0033 92c4fe        	and	a,[_IO_Input$L-2.w]
1127  0036 92c7fe        	ld	[_IO_Input$L-2.w],a
1129  0039 2008          	jra	L316
1130  003b               L116:
1131                     ; 51         *PortOR |= (unsigned char)(Pin_Val1) ;           
1133  003b 92c6fe        	ld	a,[_IO_Input$L-2.w]
1134  003e ba02          	or	a,_IO_Input$L+2
1135  0040 92c7fe        	ld	[_IO_Input$L-2.w],a
1136  0043               L316:
1137                     ; 54 } 
1140  0043 81            	ret
1235                     ; 63 void IO_Output (IO_Output_Mode Output_Val,IO_Port Port_Val2, IO_Pin Pin_Val2)
1235                     ; 64 {                   
1236                     	switch	.text
1238                     	xref.b	_IO_Output$L
1239  0044               _IO_Output:
1241  0044 b701          	ld	_IO_Output$L+1,a
1242  0046 bf00          	ld	_IO_Output$L,x
1244                     ; 68     PortDDR = PortAddr[Port_Val2]+1;
1246  0048 97            	ld	x,a
1247  0049 d60000        	ld	a,(L364_PortAddr,x)
1248  004c 4c            	inc	a
1249  004d 5f            	clr	x
1250  004e b7fd          	ld	_IO_Output$L-3,a
1251  0050 bffc          	ld	_IO_Output$L-4,x
1252                     ; 69     *PortDDR |= (unsigned char)Pin_Val2 ;  /* 端口配置为输出模式 */    
1254  0052 92c6fc        	ld	a,[_IO_Output$L-4.w]
1255  0055 ba02          	or	a,_IO_Output$L+2
1256  0057 92c7fc        	ld	[_IO_Output$L-4.w],a
1257                     ; 70     PortOR = PortAddr[Port_Val2]+2;
1259  005a be01          	ld	x,_IO_Output$L+1
1260  005c d60000        	ld	a,(L364_PortAddr,x)
1261  005f ab02          	add	a,#2
1262  0061 5f            	clr	x
1263  0062 b7ff          	ld	_IO_Output$L-1,a
1264  0064 bffe          	ld	_IO_Output$L-2,x
1265                     ; 71     if (Output_Val == IO_OPEN_DRAIN )
1267  0066 b600          	ld	a,_IO_Output$L
1268  0068 a101          	cp	a,#1
1269  006a 260b          	jrne	L366
1270                     ; 73         *PortOR &= (unsigned char)(~(unsigned char)( Pin_Val2 )) ;
1272  006c b602          	ld	a,_IO_Output$L+2
1273  006e 43            	cpl	a
1274  006f 92c4fe        	and	a,[_IO_Output$L-2.w]
1275  0072 92c7fe        	ld	[_IO_Output$L-2.w],a
1277  0075 2008          	jra	L566
1278  0077               L366:
1279                     ; 77         *PortOR |= (unsigned char)(Pin_Val2 ) ;           
1281  0077 92c6fe        	ld	a,[_IO_Output$L-2.w]
1282  007a ba02          	or	a,_IO_Output$L+2
1283  007c 92c7fe        	ld	[_IO_Output$L-2.w],a
1284  007f               L566:
1285                     ; 80 }    
1288  007f 81            	ret
1333                     ; 89 unsigned char IO_Read (IO_Port Read_Val)
1333                     ; 90 {   
1334                     	switch	.text
1336                     	xref.b	_IO_Read$L
1337  0080               _IO_Read:
1340                     ; 93     PortDR = PortAddr[Read_Val];
1342  0080 97            	ld	x,a
1343  0081 d60000        	ld	a,(L364_PortAddr,x)
1344  0084 5f            	clr	x
1345  0085 b7ff          	ld	_IO_Read$L-1,a
1346  0087 bffe          	ld	_IO_Read$L-2,x
1347                     ; 94     return *PortDR;
1349  0089 92c6fe        	ld	a,[_IO_Read$L-2.w]
1352  008c 81            	ret
1444                     ; 104 void IO_Write (IO_Port Port_Val3,IO_Pin Pin_Val3, IO_Write_Data Data_Val)
1444                     ; 105 {
1445                     	switch	.text
1447                     	xref.b	_IO_Write$L
1448  008d               _IO_Write:
1450  008d b701          	ld	_IO_Write$L+1,a
1451  008f bf00          	ld	_IO_Write$L,x
1453                     ; 108     PortDR = PortAddr[Port_Val3];
1455  0091 d60000        	ld	a,(L364_PortAddr,x)
1456  0094 5f            	clr	x
1457  0095 b7ff          	ld	_IO_Write$L-1,a
1458  0097 bffe          	ld	_IO_Write$L-2,x
1459                     ; 110     if (Data_Val == IO_DATA_HIGH )
1461  0099 b602          	ld	a,_IO_Write$L+2
1462  009b a101          	cp	a,#1
1463  009d 260a          	jrne	L557
1464                     ; 112         *PortDR |= (unsigned char)Pin_Val3 ; 
1466  009f 92c6fe        	ld	a,[_IO_Write$L-2.w]
1467  00a2 ba01          	or	a,_IO_Write$L+1
1468  00a4 92c7fe        	ld	[_IO_Write$L-2.w],a
1470  00a7 2019          	jra	L757
1471  00a9               L557:
1472                     ; 114     else if (Data_Val == IO_DATA_TOGGLE )
1474  00a9 b602          	ld	a,_IO_Write$L+2
1475  00ab a103          	cp	a,#3
1476  00ad 260a          	jrne	L167
1477                     ; 116         *PortDR ^= (unsigned char)(Pin_Val3) ;  /* 切换所选的端口引脚 */                                   
1479  00af 92c6fe        	ld	a,[_IO_Write$L-2.w]
1480  00b2 b801          	xor	a,_IO_Write$L+1
1481  00b4 92c7fe        	ld	[_IO_Write$L-2.w],a
1483  00b7 2009          	jra	L757
1484  00b9               L167:
1485                     ; 120         *PortDR &= (unsigned char)(~(unsigned char)(Pin_Val3)) ;
1487  00b9 b601          	ld	a,_IO_Write$L+1
1488  00bb 43            	cpl	a
1489  00bc 92c4fe        	and	a,[_IO_Write$L-2.w]
1490  00bf 92c7fe        	ld	[_IO_Write$L-2.w],a
1491  00c2               L757:
1492                     ; 122 }  
1495  00c2 81            	ret
1549                     ; 131 void IO_ByteWrite (IO_Port Port_Val4,unsigned char IO_ByteData)
1549                     ; 132 {   
1550                     	switch	.text
1552                     	xref.b	_IO_ByteWrite$L
1553  00c3               _IO_ByteWrite:
1555  00c3 b701          	ld	_IO_ByteWrite$L+1,a
1556  00c5 bf00          	ld	_IO_ByteWrite$L,x
1558                     ; 135     PortDR = PortAddr[Port_Val4];
1560  00c7 d60000        	ld	a,(L364_PortAddr,x)
1561  00ca 5f            	clr	x
1562  00cb b7ff          	ld	_IO_ByteWrite$L-1,a
1563  00cd bffe          	ld	_IO_ByteWrite$L-2,x
1564                     ; 136     *PortDR = IO_ByteData;
1566  00cf b601          	ld	a,_IO_ByteWrite$L+1
1567  00d1 92c7fe        	ld	[_IO_ByteWrite$L-2.w],a
1568                     ; 139 }
1571  00d4 81            	ret
1596                     	xdef	_IO_ByteWrite
1597                     	xdef	_IO_Write
1598                     	xdef	_IO_Read
1599                     	xdef	_IO_Output
1600                     	xdef	_IO_Input
1601                     	xdef	_IO_Init
1620                     	end

⌨️ 快捷键说明

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