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

📄 rs485_51device.s

📁 电梯楼层采集器代码
💻 S
📖 第 1 页 / 共 2 页
字号:
; 	Cyc_manage |= 0x02;	
	lds R24,_Cyc_manage
	ori R24,2
	sts _Cyc_manage,R24
	.dbline 132
;   }
L37:
	.dbline -2
L36:
	.dbline 0 ; func end
	adiw R28,1
	xjmp pop_xgsetF03C
	.dbsym r communication 20 pS[data]
	.dbsym r count 12 i
	.dbsym r C51_buf 22 pS[Device51_StructOfProtocol]
	.dbsym r point 10 i
	.dbend
	.dbfunc e set_Device51_USER_TIME _set_Device51_USER_TIME fV
;  communication -> R20,R21
;          count -> R12,R13
;        C51_buf -> R22,R23
;          point -> R10,R11
	.even
_set_Device51_USER_TIME::
	xcall push_xgsetF03C
	sbiw R28,1
	.dbline -1
	.dbline 137
; }
; //------------------------------------------------------------------------------
; //设用户时间组授权资料 
; void set_Device51_USER_TIME(void)
; {
	.dbline 141
;   unsigned int point,count;
;   struct Device51_StructOfProtocol *C51_buf;
;   struct data *communication;
;   C51_buf = (struct Device51_StructOfProtocol*)C51Buffer485;
	ldi R22,<_C51Buffer485
	ldi R23,>_C51Buffer485
	.dbline 142
;   point = *(unsigned int *)C51_buf->Data;
	movw R30,R22
	ldd R10,z+4
	ldd R11,z+5
	.dbline 143
;   if(point <sizeof(struct StructOfUserTimezone))
	movw R24,R10
	cpi R24,76
	ldi R26,29
	cpc R25,R26
	brlo X20
	xjmp L42
X20:
X18:
	.dbline 144
;   {//发送用户时间组授权资料给51控制板
	.dbline 145
;     count = sizeof(struct StructOfUserTimezone) - point ;
	ldi R24,7500
	ldi R25,29
	movw R12,R24
	sub R12,R10
	sbc R13,R11
	.dbline 146
; 	if (count < 256 - 8) C51_buf->Length = count + 1;
	movw R24,R12
	cpi R24,248
	ldi R26,0
	cpc R25,R26
	brsh L44
X19:
	.dbline 146
	adiw R24,1
	std z+2,R25
	std z+1,R24
	xjmp L45
L44:
	.dbline 147
;     else  C51_buf->Length = 256 - 8;
	ldi R24,248
	ldi R25,0
	movw R30,R22
	std z+2,R25
	std z+1,R24
L45:
	.dbline 148
; 	point += USER_TIMEZONE_Address;
	movw R24,R10
	subi R24,189  ; offset = 579
	sbci R25,253
	movw R10,R24
	.dbline 149
; 	I2C_Initial();
	xcall _I2C_Initial
	.dbline 150
; 	AT24_Read((unsigned char *)&C51_buf->Data,point,C51_buf->Length-1);
	movw R30,R22
	ldd R24,z+1
	ldd R25,z+2
	sbiw R24,1
	std y+0,R24
	movw R18,R10
	movw R16,R30
	subi R16,252  ; offset = 4
	sbci R17,255
	xcall _AT24_Read
	.dbline 151
; 	I2C_Close();
	xcall _I2C_Close
	.dbline 152
;   	communication->c51_txd = 1; 
	ldi R24,1
	movw R30,R20
	std z+3,R24
	.dbline 153
; 	Cyc_manage |= 0x02;	
	lds R24,_Cyc_manage
	ori R24,2
	sts _Cyc_manage,R24
	.dbline 154
;   }
L42:
	.dbline -2
L41:
	.dbline 0 ; func end
	adiw R28,1
	xjmp pop_xgsetF03C
	.dbsym r communication 20 pS[data]
	.dbsym r count 12 i
	.dbsym r C51_buf 22 pS[Device51_StructOfProtocol]
	.dbsym r point 10 i
	.dbend
	.dbfunc e set_Device51_AUTH_TIME _set_Device51_AUTH_TIME fV
;  communication -> R20,R21
;          count -> R12,R13
;        C51_buf -> R22,R23
;          point -> R10,R11
	.even
_set_Device51_AUTH_TIME::
	xcall push_xgsetF03C
	sbiw R28,1
	.dbline -1
	.dbline 159
; }
; //------------------------------------------------------------------------------
; //设电梯授权时间组  
; void set_Device51_AUTH_TIME(void)
; {
	.dbline 163
;   unsigned int point,count;
;   struct Device51_StructOfProtocol *C51_buf;
;   struct data *communication;
;   C51_buf = (struct Device51_StructOfProtocol*)C51Buffer485;
	ldi R22,<_C51Buffer485
	ldi R23,>_C51Buffer485
	.dbline 164
;   point = *(unsigned int *)C51_buf->Data;
	movw R30,R22
	ldd R10,z+4
	ldd R11,z+5
	.dbline 165
;   if(point <sizeof(struct StructOfLiftSchedule))
	movw R24,R10
	cpi R24,105
	ldi R26,0
	cpc R25,R26
	brlo X23
	xjmp L47
X23:
X21:
	.dbline 166
;   {//发送电梯授权时间组给51控制板
	.dbline 167
;    count = sizeof(struct StructOfLiftSchedule) - point;
	ldi R24,105
	ldi R25,0
	movw R12,R24
	sub R12,R10
	sbc R13,R11
	.dbline 168
;    if (count < 256 - 8) C51_buf->Length = count + 1;
	movw R24,R12
	cpi R24,248
	ldi R26,0
	cpc R25,R26
	brsh L49
X22:
	.dbline 168
	adiw R24,1
	std z+2,R25
	std z+1,R24
	xjmp L50
L49:
	.dbline 169
;    else  C51_buf->Length = 256 - 8;
	ldi R24,248
	ldi R25,0
	movw R30,R22
	std z+2,R25
	std z+1,R24
L50:
	.dbline 170
;    point += LIFT_SCHEDULE_Address;
	movw R24,R10
	adiw R24,54
	movw R10,R24
	.dbline 171
;    I2C_Initial();
	xcall _I2C_Initial
	.dbline 172
;    AT24_Read((unsigned char *)&C51_buf->Data,point,C51_buf->Length-1);
	movw R30,R22
	ldd R24,z+1
	ldd R25,z+2
	sbiw R24,1
	std y+0,R24
	movw R18,R10
	movw R16,R30
	subi R16,252  ; offset = 4
	sbci R17,255
	xcall _AT24_Read
	.dbline 173
;    I2C_Close();
	xcall _I2C_Close
	.dbline 174
;    communication->c51_txd = 1; 
	ldi R24,1
	movw R30,R20
	std z+3,R24
	.dbline 175
;    Cyc_manage |= 0x02;	
	lds R24,_Cyc_manage
	ori R24,2
	sts _Cyc_manage,R24
	.dbline 176
;   }
L47:
	.dbline -2
L46:
	.dbline 0 ; func end
	adiw R28,1
	xjmp pop_xgsetF03C
	.dbsym r communication 20 pS[data]
	.dbsym r count 12 i
	.dbsym r C51_buf 22 pS[Device51_StructOfProtocol]
	.dbsym r point 10 i
	.dbend
	.dbfunc e set_Device51_CONFIG _set_Device51_CONFIG fV
;  communication -> R20,R21
;        C51_buf -> R22,R23
	.even
_set_Device51_CONFIG::
	xcall push_xgsetF000
	sbiw R28,1
	.dbline -1
	.dbline 181
; }
; //------------------------------------------------------------------------------
; /*设置系统配置参数*/
; void set_Device51_CONFIG(void)
; {
	.dbline 184
;   struct Device51_StructOfProtocol *C51_buf;
;   struct data *communication;
;   C51_buf = (struct Device51_StructOfProtocol*)C51Buffer485;
	ldi R22,<_C51Buffer485
	ldi R23,>_C51Buffer485
	.dbline 185
;   C51_buf->Length = sizeof(SystemConfig) + 1;
	ldi R24,33
	ldi R25,0
	movw R30,R22
	std z+2,R25
	std z+1,R24
	.dbline 186
;   I2C_Initial();
	xcall _I2C_Initial
	.dbline 187
;   AT24_Read((unsigned char *)&C51_buf->Data,SystemConfig_Address,C51_buf->Length-1);
	movw R30,R22
	ldd R24,z+1
	ldd R25,z+2
	sbiw R24,1
	std y+0,R24
	clr R18
	clr R19
	movw R16,R30
	subi R16,252  ; offset = 4
	sbci R17,255
	xcall _AT24_Read
	.dbline 188
;   I2C_Close();
	xcall _I2C_Close
	.dbline 189
;   communication->c51_txd = 1; 
	ldi R24,1
	movw R30,R20
	std z+3,R24
	.dbline 190
;   Cyc_manage |= 0x02;	
	lds R24,_Cyc_manage
	ori R24,2
	sts _Cyc_manage,R24
	.dbline -2
L51:
	.dbline 0 ; func end
	adiw R28,1
	xjmp pop_xgsetF000
	.dbsym r communication 20 pS[data]
	.dbsym r C51_buf 22 pS[Device51_StructOfProtocol]
	.dbend
	.dbfunc e set_Device51_PRODUCT_CODE _set_Device51_PRODUCT_CODE fV
;  communication -> R20,R21
;        C51_buf -> R22,R23
	.even
_set_Device51_PRODUCT_CODE::
	xcall push_xgsetF000
	sbiw R28,1
	.dbline -1
	.dbline 195
; }
; //------------------------------------------------------------------------------
; //设置产品标签代码 
; void set_Device51_PRODUCT_CODE(void)
; {
	.dbline 198
;   struct Device51_StructOfProtocol *C51_buf;
;   struct data *communication;
;   C51_buf = (struct Device51_StructOfProtocol*)C51Buffer485;
	ldi R22,<_C51Buffer485
	ldi R23,>_C51Buffer485
	.dbline 199
;   C51_buf->Length = sizeof(struct StructOfProductCode) + 1;
	ldi R24,251
	ldi R25,0
	movw R30,R22
	std z+2,R25
	std z+1,R24
	.dbline 200
;   I2C_Initial();
	xcall _I2C_Initial
	.dbline 201
;   AT24_Read((unsigned char *)&C51_buf->Data,StructOfProductCode_Address,C51_buf->Length-1);
	movw R30,R22
	ldd R24,z+1
	ldd R25,z+2
	sbiw R24,1
	std y+0,R24
	ldi R18,39610
	ldi R19,154
	movw R16,R30
	subi R16,252  ; offset = 4
	sbci R17,255
	xcall _AT24_Read
	.dbline 202
;   I2C_Close();
	xcall _I2C_Close
	.dbline 203
;   communication->c51_txd = 1; 
	ldi R24,1
	movw R30,R20
	std z+3,R24
	.dbline 204
;   Cyc_manage |= 0x02;	
	lds R24,_Cyc_manage
	ori R24,2
	sts _Cyc_manage,R24
	.dbline -2
L52:
	.dbline 0 ; func end
	adiw R28,1
	xjmp pop_xgsetF000
	.dbsym r communication 20 pS[data]
	.dbsym r C51_buf 22 pS[Device51_StructOfProtocol]
	.dbend
	.dbfunc e set_Device51_UNIT_STATUS _set_Device51_UNIT_STATUS fV
	.even
_set_Device51_UNIT_STATUS::
	.dbline -1
	.dbline 209
; }
; //------------------------------------------------------------------------------
; /*设置控制器状态*/
; void set_Device51_UNIT_STATUS(void)
; {
	.dbline -2
L53:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e update_data_51director _update_data_51director fV
;       Device51 -> R10,R11
;        C51_buf -> R22,R23
;              i -> R20
	.even
_update_data_51director::
	xcall push_xgsetF03C
	.dbline -1
	.dbline 219
; 
; 
; }
; 
; 
; //------------------------------------------------------------------------------
; //------------------------------------------------------------------------------
; //更新51控制板
; void update_data_51director(void)
; {
	.dbline 223
;   unsigned char i;
;   struct Device51_StructOfProtocol *C51_buf;
;   struct Device51_Address *Device51; 
;   C51_buf = (struct Device51_StructOfProtocol*)C51Buffer485;
	ldi R22,<_C51Buffer485
	ldi R23,>_C51Buffer485
	.dbline 224
;   for(i=0;i<sizeof(struct ReadHC165Switch);i++)
	clr R20
	xjmp L58
L55:
	.dbline 225
;   {  
	.dbline 226
;    C51_buf->Address = Device51->Address[i]; 
	mov R30,R20
	clr R31
	add R30,R10
	adc R31,R11
	ldd R2,z+0
	movw R30,R22
	std z+0,R2
	.dbline 227
;    switch(C51_buf->Command)
	ldd R12,z+3
	clr R13
	movw R24,R12
	cpi R24,63
	ldi R30,0
	cpc R25,R30
	brne X34
	xjmp L68
X34:
X24:
	ldi R24,63
	cp R24,R12
	cpc R25,R13
	brlt L71
X25:
L70:
	movw R24,R12
	cpi R24,34
	ldi R30,0
	cpc R25,R30
	breq L62
X26:
	cpi R24,35
	ldi R30,0
	cpc R25,R30
	breq L67
X27:
	cpi R24,36
	ldi R30,0
	cpc R25,R30
	breq L63
X28:
	cpi R24,37
	ldi R30,0
	cpc R25,R30
	breq L64
X29:
	cpi R24,38
	ldi R30,0
	cpc R25,R30
	breq L65
X30:
	cpi R24,45
	ldi R30,0
	cpc R25,R30
	breq L66
X31:
	xjmp L60
L71:
	movw R24,R12
	cpi R24,96
	ldi R30,0
	cpc R25,R30
	breq L69
X32:
	xjmp L60
L62:
	.dbline 230
;    {
;    	 case CMD_SET_TIME://下载系统时间
; 	 	  set_Device51_TIME();
	xcall _set_Device51_TIME
	.dbline 231
; 		  break;
	xjmp L60
L63:
	.dbline 233
;    	 case CMD_SET_CARDSET://下载系统卡注册表
; 	      set_Device51_CARDSET();
	xcall _set_Device51_CARDSET
	.dbline 234
; 		  break;
	xjmp L60
L64:
	.dbline 236
; 	 case CMD_SET_USER://下载门禁时间组(设用户楼层授权资料)  	   
;    	 	  set_Device51_USER();
	xcall _set_Device51_USER
	.dbline 237
; 		  break;
	xjmp L60
L65:
	.dbline 239
;      case CMD_SET_USER_TIME://设用户时间组授权资料 
; 	 	  set_Device51_USER_TIME();
	xcall _set_Device51_USER_TIME
	.dbline 240
; 		  break; 
	xjmp L60
L66:
	.dbline 242
; 	 case CMD_SET_AUTH_TIME://设电梯授权时间组  
; 		  set_Device51_AUTH_TIME();
	xcall _set_Device51_AUTH_TIME
	.dbline 243
; 		  break;
	xjmp L60
L67:
	.dbline 245
; 	 case CMD_SET_CONFIG: //设置系统配置参数  
; 		  set_Device51_CONFIG();
	xcall _set_Device51_CONFIG
	.dbline 246
; 		  break; 
	xjmp L60
L68:
	.dbline 248
; 	 case CMD_SET_PRODUCT_CODE://设置产品标签代码  
; 	 	  set_Device51_PRODUCT_CODE();
	xcall _set_Device51_PRODUCT_CODE
	.dbline 249
; 		  break;
	xjmp L60
L69:
	.dbline 251
; 	 case CTL_SET_UNIT_STATUS: /*设置控制器状态*/	 
; 		  set_Device51_UNIT_STATUS();
	xcall _set_Device51_UNIT_STATUS
	.dbline 252
; 		  break;
	.dbline 254
; 	 default:
; 	 	  break;
L60:
	.dbline 256
;    }
;   }
L56:
	.dbline 224
	inc R20
L58:
	.dbline 224
	cpi R20,3
	brsh X35
	xjmp L55
X35:
X33:
	.dbline -2
L54:
	.dbline 0 ; func end
	xjmp pop_xgsetF03C
	.dbsym r Device51 10 pS[Device51_Address]
	.dbsym r C51_buf 22 pS[Device51_StructOfProtocol]
	.dbsym r i 20 c
	.dbend
; }
; //------------------------------------------------------------------------------

⌨️ 快捷键说明

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