📄 app.s
字号:
; {
; t_model=1; //运动类型 手动提升
ldi R24,1
ldi R25,0
sts _t_model+1,R25
sts _t_model,R24
; auto_s_2=0; // 撤销自动上升次数累加
clr R2
clr R3
sts _auto_s_2+1,R3
sts _auto_s_2,R2
; auto_x_2=0; //撤销自动下降累加
sts _auto_x_2+1,R3
sts _auto_x_2,R2
; }
xjmp L139
L138:
; else if(rx_chr[2][7][1])
lds R2,_rx_chr+32+14+1
tst R2
breq L143
; {
; t_model=2; //运动类型 手动提升
ldi R24,2
ldi R25,0
sts _t_model+1,R25
sts _t_model,R24
; auto_s_2=0; // 撤销自动上升次数累加
clr R2
clr R3
sts _auto_s_2+1,R3
sts _auto_s_2,R2
; auto_x_2=0; //撤销自动下降累加
sts _auto_x_2+1,R3
sts _auto_x_2,R2
; }
xjmp L144
L143:
; else if(rx_chr[2][5][1]&rx_chr[1][4][1]&(~rx_chr[1][4][0]))//自动上升 按下一次
lds R2,_rx_chr+16+8+1
lds R3,_rx_chr+32+10+1
and R3,R2
lds R2,_rx_chr+16+8
com R2
and R3,R2
breq L148
; {
; t_model=3; //运动类型 自动上升 (中间停)
ldi R24,3
ldi R25,0
sts _t_model+1,R25
sts _t_model,R24
; auto_s_2++; // 自动上升次数累加
lds R24,_auto_s_2
lds R25,_auto_s_2+1
adiw R24,1
sts _auto_s_2+1,R25
sts _auto_s_2,R24
; auto_x_2=0; //撤销自动下降累加
clr R2
clr R3
sts _auto_x_2+1,R3
sts _auto_x_2,R2
; }
xjmp L149
L148:
; else if(rx_chr[2][5][1]&rx_chr[1][6][1]&(~rx_chr[1][6][0]))//自动下降 按下一次
lds R2,_rx_chr+16+12+1
lds R3,_rx_chr+32+10+1
and R3,R2
lds R2,_rx_chr+16+12
com R2
and R3,R2
breq L158
; {
; t_model=4; //运动类型 自动下降(中间停)
ldi R24,4
ldi R25,0
sts _t_model+1,R25
sts _t_model,R24
; auto_s_2=0; // 自动下降累加
clr R2
clr R3
sts _auto_s_2+1,R3
sts _auto_s_2,R2
; auto_x_2++; // 撤销上升次数累加
lds R24,_auto_x_2
lds R25,_auto_x_2+1
adiw R24,1
sts _auto_x_2+1,R25
sts _auto_x_2,R24
; }
xjmp L159
L158:
;
; else if(rx_chr[2][5][1]&rx_chr[2][2][1]&(~rx_chr[2][2][0]))//自动上升下降到底
lds R2,_rx_chr+32+4+1
lds R3,_rx_chr+32+10+1
and R3,R2
lds R2,_rx_chr+32+4
com R2
and R3,R2
breq L168
; {
; t_model=5; //运动类型 自动上升到底
ldi R24,5
ldi R25,0
sts _t_model+1,R25
sts _t_model,R24
; auto_s_2=0; // 撤销自动下降累加
clr R2
clr R3
sts _auto_s_2+1,R3
sts _auto_s_2,R2
; auto_x_2=0; // 撤销上升次数累加
sts _auto_x_2+1,R3
sts _auto_x_2,R2
; }
xjmp L169
L168:
; else if(rx_chr[2][5][1]&rx_chr[2][0][1]&(~rx_chr[2][0][0]))
lds R2,_rx_chr+32+1
lds R3,_rx_chr+32+10+1
and R3,R2
lds R2,_rx_chr+32
com R2
and R3,R2
breq L178
; {
; t_model=6; //运动类型 自动下降到底
ldi R24,6
ldi R25,0
sts _t_model+1,R25
sts _t_model,R24
; auto_s_2=0; // 撤销自动下降累加
clr R2
clr R3
sts _auto_s_2+1,R3
sts _auto_s_2,R2
; auto_x_2=0; // 撤销上升次数累加
sts _auto_x_2+1,R3
sts _auto_x_2,R2
;
; }
L178:
L169:
L159:
L149:
L144:
L139:
; ///自动提升完成程度判断
; switch(t_model)
lds R24,_t_model
lds R25,_t_model+1
cpi R24,1
ldi R30,0
cpc R25,R30
breq L188
cpi R24,2
ldi R30,0
cpc R25,R30
breq L193
cpi R24,3
ldi R30,0
cpc R25,R30
breq L197
cpi R24,4
ldi R30,0
cpc R25,R30
brne X24
xjmp L212
X24:
cpi R24,5
ldi R30,0
cpc R25,R30
brne X25
xjmp L226
X25:
cpi R24,6
ldi R30,0
cpc R25,R30
brne X26
xjmp L231
X26:
xjmp L186
X1:
; {
L188:
; case 1: if(!contact_t[2][1]) t_model=0;break;
lds R2,_contact_t+8+2
lds R3,_contact_t+8+2+1
tst R2
breq X27
xjmp L187
X27:
tst R3
breq X28
xjmp L187
X28:
X2:
clr R2
clr R3
sts _t_model+1,R3
sts _t_model,R2
xjmp L187
L193:
; case 2: if(!contact_t[0][1]) t_model=0;break; //下降完全到底
lds R2,_contact_t+2
lds R3,_contact_t+2+1
tst R2
breq X29
xjmp L187
X29:
tst R3
breq X30
xjmp L187
X30:
X3:
clr R2
clr R3
sts _t_model+1,R3
sts _t_model,R2
xjmp L187
L197:
; case 3: if((!contact_t[3][1])&contact_t[3][0]&(auto_s_2>0)) auto_s_2 --;if((auto_s_2==0)||(!contact_t[2][1])) t_model=0;break; //自动上升 中间停 完成一次任务
lds R2,_contact_t+12+2
lds R3,_contact_t+12+2+1
tst R2
brne L203
tst R3
brne L203
X4:
ldi R22,1
ldi R23,0
xjmp L204
L203:
clr R22
clr R23
L204:
lds R2,_auto_s_2
lds R3,_auto_s_2+1
tst R2
brne X5
tst R3
breq L205
X5:
ldi R20,1
ldi R21,0
xjmp L206
L205:
clr R20
clr R21
L206:
lds R2,_contact_t+12
lds R3,_contact_t+12+1
movw R4,R22
and R4,R2
and R5,R3
and R4,R20
and R5,R21
tst R4
brne X6
tst R5
breq L198
X6:
lds R24,_auto_s_2
lds R25,_auto_s_2+1
sbiw R24,1
sts _auto_s_2+1,R25
sts _auto_s_2,R24
L198:
lds R2,_auto_s_2
lds R3,_auto_s_2+1
tst R2
brne X7
tst R3
breq L211
X7:
lds R2,_contact_t+8+2
lds R3,_contact_t+8+2+1
tst R2
breq X31
xjmp L187
X31:
tst R3
breq X32
xjmp L187
X32:
X8:
L211:
clr R2
clr R3
sts _t_model+1,R3
sts _t_model,R2
xjmp L187
L212:
; case 4: if((!contact_t[3][1])&contact_t[3][0]&(auto_x_2>0)) auto_x_2 --;if((auto_x_2==0)||(!contact_t[0][1])) t_model=0;break; //自动下降 中间停 完成一次任务
lds R2,_contact_t+12+2
lds R3,_contact_t+12+2+1
tst R2
brne L218
tst R3
brne L218
X9:
ldi R22,1
ldi R23,0
xjmp L219
L218:
clr R22
clr R23
L219:
lds R2,_auto_x_2
lds R3,_auto_x_2+1
tst R2
brne X10
tst R3
breq L220
X10:
ldi R20,1
ldi R21,0
xjmp L221
L220:
clr R20
clr R21
L221:
lds R2,_contact_t+12
lds R3,_contact_t+12+1
movw R4,R22
and R4,R2
and R5,R3
and R4,R20
and R5,R21
tst R4
brne X11
tst R5
breq L213
X11:
lds R24,_auto_x_2
lds R25,_auto_x_2+1
sbiw R24,1
sts _auto_x_2+1,R25
sts _auto_x_2,R24
L213:
lds R2,_auto_x_2
lds R3,_auto_x_2+1
tst R2
brne X12
tst R3
breq L225
X12:
lds R2,_contact_t+2
lds R3,_contact_t+2+1
tst R2
brne L187
tst R3
brne L187
X13:
L225:
clr R2
clr R3
sts _t_model+1,R3
sts _t_model,R2
xjmp L187
L226:
; case 5: if(!contact_t[2][1]) t_model=0;break; //自动上升完全到顶
lds R2,_contact_t+8+2
lds R3,_contact_t+8+2+1
tst R2
brne L187
tst R3
brne L187
X14:
clr R2
clr R3
sts _t_model+1,R3
sts _t_model,R2
xjmp L187
L231:
; case 6: if(!contact_t[0][1]) t_model=0;break; //自动下降完全到底
lds R2,_contact_t+2
lds R3,_contact_t+2+1
tst R2
brne L187
tst R3
brne L187
X15:
clr R2
clr R3
sts _t_model+1,R3
sts _t_model,R2
L186:
L187:
lds R24,_t_model
lds R25,_t_model+1
cpi R24,1
ldi R30,0
cpc R25,R30
breq L238
cpi R24,3
ldi R30,0
cpc R25,R30
breq L238
cpi R24,5
ldi R30,0
cpc R25,R30
brne L235
L238:
; }
;
; //运动产生
; if(t_model==1||t_model==3||t_model==5) motor_t_msg=11; //上升
ldi R24,11
ldi R25,0
sts _motor_t_msg+1,R25
sts _motor_t_msg,R24
xjmp L236
L235:
lds R24,_t_model
lds R25,_t_model+1
cpi R24,2
ldi R30,0
cpc R25,R30
breq L242
cpi R24,4
ldi R30,0
cpc R25,R30
breq L242
cpi R24,6
ldi R30,0
cpc R25,R30
brne L239
L242:
; else if(t_model==2||t_model==4||t_model==6) motor_t_msg=12; //下降
ldi R24,12
ldi R25,0
sts _motor_t_msg+1,R25
sts _motor_t_msg,R24
xjmp L240
L239:
; else motor_t_msg=10; //停
ldi R24,10
ldi R25,0
sts _motor_t_msg+1,R25
sts _motor_t_msg,R24
L240:
L236:
; OSMboxPost(motor_t_Box,&motor_t_msg);
ldi R18,<_motor_t_msg
ldi R19,>_motor_t_msg
lds R16,_motor_t_Box
lds R17,_motor_t_Box+1
xcall _OSMboxPost
lds R24,_t_model
lds R25,_t_model+1
cpi R24,1
ldi R30,0
cpc R25,R30
breq L245
cpi R24,2
ldi R30,0
cpc R25,R30
brne L243
L245:
;
; if((t_model==1)||(t_model==2))t_model=0; //手动完成任务 变为停
clr R2
clr R3
sts _t_model+1,R3
sts _t_model,R2
L243:
;
;
; //手抓控制部分-------------------------------------------------
;
;
; if((~rx_chr[2][3][0])&rx_chr[2][3][1]&(~rx_chr[2][5][1]))
lds R2,_rx_chr+32+6+1
lds R3,_rx_chr+32+6
com R3
and R3,R2
lds R2,_rx_chr+32+10+1
com R2
and R3,R2
brne X33
xjmp L246
X33:
; {
; switch(hand_whe[0])
lds R20,_hand_whe
lds R21,_hand_whe+1
cpi R20,0
cpc R20,R21
breq L259
X16:
cpi R20,1
ldi R30,0
cpc R21,R30
breq L260
cpi R20,2
ldi R30,0
cpc R21,R30
breq L261
cpi R20,3
ldi R30,0
cpc R21,R30
breq L262
xjmp L256
X17:
; {
L259:
; case 0: hand_cy[0]=hand_st_2[0];hand_whe[0]=1;break;
lds R2,_hand_st_2
lds R3,_hand_st_2+1
sts _hand_cy+1,R3
sts _hand_cy,R2
ldi R24,1
ldi R25,0
sts _hand_whe+1,R25
sts _hand_whe,R24
xjmp L257
L260:
; case 1: hand_cy[0]=hand_st_3[0];hand_whe[0]=2;break;
lds R2,_hand_st_3
lds R3,_hand_st_3+1
sts _hand_cy+1,R3
sts _hand_cy,R2
ldi R24,2
ldi R25,0
sts _hand_whe+1,R25
sts _hand_whe,R24
xjmp L257
L261:
; case 2: hand_cy[0]=hand_st_2[0];hand_whe[0]=3;break;
lds R2,_hand_st_2
lds R3,_hand_st_2+1
sts _hand_cy+1,R3
sts _hand_cy,R2
ldi R24,3
ldi R25,0
sts _hand_whe+1,R25
sts _hand_whe,R24
xjmp L257
L262:
; case 3: hand_cy[0]=hand_st_1[0];hand_whe[0]=0;break;
lds R2,_hand_st_1
lds R3,_hand_st_1+1
sts _hand_cy+1,R3
sts _hand_cy,R2
clr R2
clr R3
sts _hand_whe+1,R3
sts _hand_whe,R2
L256:
L257:
; }
; }
L246:
;
; if((~rx_chr[2][1][0])&rx_chr[2][1][1])
lds R2,_rx_chr+32+2+1
lds R3,_rx_chr+32+2
com R3
and R3,R2
brne X34
xjmp L263
X34:
; {
; switch(hand_whe[1])
lds R2,_hand_whe+2
lds R3,_hand_whe+2+1
tst R2
brne X18
tst R3
breq L273
X18:
lds R24,_hand_whe+2
lds R25,_hand_whe+2+1
cpi R24,1
ldi R30,0
cpc R25,R30
breq L277
cpi R24,2
ldi R30,0
cpc R25,R30
breq L281
cpi R24,3
ldi R30,0
cpc R25,R30
breq L285
xjmp L270
X19:
; {
L273:
; case 0: hand_cy[1]=hand_st_2[1];hand_whe[1]=1;break;
lds R2,_hand_st_2+2
lds R3,_hand_st_2+2+1
sts _hand_cy+2+1,R3
sts _hand_cy+2,R2
ldi R24,1
ldi R25,0
sts _hand_whe+2+1,R25
sts _hand_whe+2,R24
xjmp L271
L277:
; case 1: hand_cy[1]=hand_st_3[1];hand_whe[1]=2;break;
lds R2,_hand_st_3+2
lds R3,_hand_st_3+2+1
sts _hand_cy+2+1,R3
sts _hand_cy+2,R2
ldi R24,2
ldi R25,0
sts _hand_whe+2+1,R25
sts _hand_whe+2,R24
xjmp L271
L281:
; case 2: hand_cy[1]=hand_st_2[1];hand_whe[1]=3;break;
lds R2,_hand_st_2+2
lds R3,_hand_st_2+2+1
sts _hand_cy+2+1,R3
sts _hand_cy+2,R2
ldi R24,3
ldi R25,0
sts _hand_whe+2+1,R25
sts _hand_whe+2,R24
xjmp L271
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -