📄 com2iic.lss
字号:
ucTwiStatus = (TWSR & TW_NO_INFO);
236: 98 ef ldi r25, 0xF8 ; 248
238: 80 91 21 00 lds r24, 0x0021
23c: 89 23 and r24, r25
23e: 89 83 std Y+1, r24 ; 0x01
switch(ucTwiStatus)
240: 89 81 ldd r24, Y+1 ; 0x01
242: 28 2f mov r18, r24
244: 33 27 eor r19, r19
246: 2a 83 std Y+2, r18 ; 0x02
248: 3b 83 std Y+3, r19 ; 0x03
24a: 8a 81 ldd r24, Y+2 ; 0x02
24c: 9b 81 ldd r25, Y+3 ; 0x03
24e: 88 36 cpi r24, 0x68 ; 104
250: 91 05 cpc r25, r1
252: 09 f4 brne .+2 ; 0x256
254: 54 c1 rjmp .+680 ; 0x4fe
256: 2a 81 ldd r18, Y+2 ; 0x02
258: 3b 81 ldd r19, Y+3 ; 0x03
25a: 29 36 cpi r18, 0x69 ; 105
25c: 31 05 cpc r19, r1
25e: 0c f0 brlt .+2 ; 0x262
260: 61 c0 rjmp .+194 ; 0x324
262: 8a 81 ldd r24, Y+2 ; 0x02
264: 9b 81 ldd r25, Y+3 ; 0x03
266: 80 33 cpi r24, 0x30 ; 48
268: 91 05 cpc r25, r1
26a: 09 f4 brne .+2 ; 0x26e
26c: 10 c1 rjmp .+544 ; 0x48e
26e: 2a 81 ldd r18, Y+2 ; 0x02
270: 3b 81 ldd r19, Y+3 ; 0x03
272: 21 33 cpi r18, 0x31 ; 49
274: 31 05 cpc r19, r1
276: 2c f5 brge .+74 ; 0x2c2
278: 8a 81 ldd r24, Y+2 ; 0x02
27a: 9b 81 ldd r25, Y+3 ; 0x03
27c: 88 31 cpi r24, 0x18 ; 24
27e: 91 05 cpc r25, r1
280: 09 f4 brne .+2 ; 0x284
282: c0 c0 rjmp .+384 ; 0x404
284: 2a 81 ldd r18, Y+2 ; 0x02
286: 3b 81 ldd r19, Y+3 ; 0x03
288: 29 31 cpi r18, 0x19 ; 25
28a: 31 05 cpc r19, r1
28c: 6c f4 brge .+26 ; 0x2a8
28e: 8a 81 ldd r24, Y+2 ; 0x02
290: 9b 81 ldd r25, Y+3 ; 0x03
292: 88 30 cpi r24, 0x08 ; 8
294: 91 05 cpc r25, r1
296: 09 f4 brne .+2 ; 0x29a
298: a6 c0 rjmp .+332 ; 0x3e6
29a: 2a 81 ldd r18, Y+2 ; 0x02
29c: 3b 81 ldd r19, Y+3 ; 0x03
29e: 20 31 cpi r18, 0x10 ; 16
2a0: 31 05 cpc r19, r1
2a2: 09 f4 brne .+2 ; 0x2a6
2a4: a0 c0 rjmp .+320 ; 0x3e6
2a6: ff c1 rjmp .+1022 ; 0x6a6
2a8: 8a 81 ldd r24, Y+2 ; 0x02
2aa: 9b 81 ldd r25, Y+3 ; 0x03
2ac: 80 32 cpi r24, 0x20 ; 32
2ae: 91 05 cpc r25, r1
2b0: 09 f4 brne .+2 ; 0x2b4
2b2: d6 c0 rjmp .+428 ; 0x460
2b4: 2a 81 ldd r18, Y+2 ; 0x02
2b6: 3b 81 ldd r19, Y+3 ; 0x03
2b8: 28 32 cpi r18, 0x28 ; 40
2ba: 31 05 cpc r19, r1
2bc: 09 f4 brne .+2 ; 0x2c0
2be: a2 c0 rjmp .+324 ; 0x404
2c0: f2 c1 rjmp .+996 ; 0x6a6
2c2: 8a 81 ldd r24, Y+2 ; 0x02
2c4: 9b 81 ldd r25, Y+3 ; 0x03
2c6: 88 34 cpi r24, 0x48 ; 72
2c8: 91 05 cpc r25, r1
2ca: 09 f4 brne .+2 ; 0x2ce
2cc: 8d c1 rjmp .+794 ; 0x5e8
2ce: 2a 81 ldd r18, Y+2 ; 0x02
2d0: 3b 81 ldd r19, Y+3 ; 0x03
2d2: 29 34 cpi r18, 0x49 ; 73
2d4: 31 05 cpc r19, r1
2d6: 6c f4 brge .+26 ; 0x2f2
2d8: 8a 81 ldd r24, Y+2 ; 0x02
2da: 9b 81 ldd r25, Y+3 ; 0x03
2dc: 88 33 cpi r24, 0x38 ; 56
2de: 91 05 cpc r25, r1
2e0: 09 f4 brne .+2 ; 0x2e4
2e2: ec c0 rjmp .+472 ; 0x4bc
2e4: 2a 81 ldd r18, Y+2 ; 0x02
2e6: 3b 81 ldd r19, Y+3 ; 0x03
2e8: 20 34 cpi r18, 0x40 ; 64
2ea: 31 05 cpc r19, r1
2ec: 09 f4 brne .+2 ; 0x2f0
2ee: 43 c1 rjmp .+646 ; 0x576
2f0: da c1 rjmp .+948 ; 0x6a6
2f2: 8a 81 ldd r24, Y+2 ; 0x02
2f4: 9b 81 ldd r25, Y+3 ; 0x03
2f6: 88 35 cpi r24, 0x58 ; 88
2f8: 91 05 cpc r25, r1
2fa: 09 f4 brne .+2 ; 0x2fe
2fc: 87 c1 rjmp .+782 ; 0x60c
2fe: 2a 81 ldd r18, Y+2 ; 0x02
300: 3b 81 ldd r19, Y+3 ; 0x03
302: 29 35 cpi r18, 0x59 ; 89
304: 31 05 cpc r19, r1
306: 3c f4 brge .+14 ; 0x316
308: 8a 81 ldd r24, Y+2 ; 0x02
30a: 9b 81 ldd r25, Y+3 ; 0x03
30c: 80 35 cpi r24, 0x50 ; 80
30e: 91 05 cpc r25, r1
310: 09 f4 brne .+2 ; 0x314
312: 37 c1 rjmp .+622 ; 0x582
314: c8 c1 rjmp .+912 ; 0x6a6
316: 2a 81 ldd r18, Y+2 ; 0x02
318: 3b 81 ldd r19, Y+3 ; 0x03
31a: 20 36 cpi r18, 0x60 ; 96
31c: 31 05 cpc r19, r1
31e: 09 f4 brne .+2 ; 0x322
320: ee c0 rjmp .+476 ; 0x4fe
322: c1 c1 rjmp .+898 ; 0x6a6
324: 8a 81 ldd r24, Y+2 ; 0x02
326: 9b 81 ldd r25, Y+3 ; 0x03
328: 88 39 cpi r24, 0x98 ; 152
32a: 91 05 cpc r25, r1
32c: 09 f4 brne .+2 ; 0x330
32e: 0f c1 rjmp .+542 ; 0x54e
330: 2a 81 ldd r18, Y+2 ; 0x02
332: 3b 81 ldd r19, Y+3 ; 0x03
334: 29 39 cpi r18, 0x99 ; 153
336: 31 05 cpc r19, r1
338: 2c f5 brge .+74 ; 0x384
33a: 8a 81 ldd r24, Y+2 ; 0x02
33c: 9b 81 ldd r25, Y+3 ; 0x03
33e: 80 38 cpi r24, 0x80 ; 128
340: 91 05 cpc r25, r1
342: 09 f4 brne .+2 ; 0x346
344: e5 c0 rjmp .+458 ; 0x510
346: 2a 81 ldd r18, Y+2 ; 0x02
348: 3b 81 ldd r19, Y+3 ; 0x03
34a: 21 38 cpi r18, 0x81 ; 129
34c: 31 05 cpc r19, r1
34e: 6c f4 brge .+26 ; 0x36a
350: 8a 81 ldd r24, Y+2 ; 0x02
352: 9b 81 ldd r25, Y+3 ; 0x03
354: 80 37 cpi r24, 0x70 ; 112
356: 91 05 cpc r25, r1
358: 09 f4 brne .+2 ; 0x35c
35a: d1 c0 rjmp .+418 ; 0x4fe
35c: 2a 81 ldd r18, Y+2 ; 0x02
35e: 3b 81 ldd r19, Y+3 ; 0x03
360: 28 37 cpi r18, 0x78 ; 120
362: 31 05 cpc r19, r1
364: 09 f4 brne .+2 ; 0x368
366: cb c0 rjmp .+406 ; 0x4fe
368: 9e c1 rjmp .+828 ; 0x6a6
36a: 8a 81 ldd r24, Y+2 ; 0x02
36c: 9b 81 ldd r25, Y+3 ; 0x03
36e: 88 38 cpi r24, 0x88 ; 136
370: 91 05 cpc r25, r1
372: 09 f4 brne .+2 ; 0x376
374: ec c0 rjmp .+472 ; 0x54e
376: 2a 81 ldd r18, Y+2 ; 0x02
378: 3b 81 ldd r19, Y+3 ; 0x03
37a: 20 39 cpi r18, 0x90 ; 144
37c: 31 05 cpc r19, r1
37e: 09 f4 brne .+2 ; 0x382
380: c7 c0 rjmp .+398 ; 0x510
382: 91 c1 rjmp .+802 ; 0x6a6
384: 8a 81 ldd r24, Y+2 ; 0x02
386: 9b 81 ldd r25, Y+3 ; 0x03
388: 80 3b cpi r24, 0xB0 ; 176
38a: 91 05 cpc r25, r1
38c: 09 f4 brne .+2 ; 0x390
38e: 7b c1 rjmp .+758 ; 0x686
390: 2a 81 ldd r18, Y+2 ; 0x02
392: 3b 81 ldd r19, Y+3 ; 0x03
394: 21 3b cpi r18, 0xB1 ; 177
396: 31 05 cpc r19, r1
398: 6c f4 brge .+26 ; 0x3b4
39a: 8a 81 ldd r24, Y+2 ; 0x02
39c: 9b 81 ldd r25, Y+3 ; 0x03
39e: 80 3a cpi r24, 0xA0 ; 160
3a0: 91 05 cpc r25, r1
3a2: 09 f4 brne .+2 ; 0x3a6
3a4: d8 c0 rjmp .+432 ; 0x556
3a6: 2a 81 ldd r18, Y+2 ; 0x02
3a8: 3b 81 ldd r19, Y+3 ; 0x03
3aa: 28 3a cpi r18, 0xA8 ; 168
3ac: 31 05 cpc r19, r1
3ae: 09 f4 brne .+2 ; 0x3b2
3b0: 4b c1 rjmp .+662 ; 0x648
3b2: 79 c1 rjmp .+754 ; 0x6a6
3b4: 8a 81 ldd r24, Y+2 ; 0x02
3b6: 9b 81 ldd r25, Y+3 ; 0x03
3b8: 80 3c cpi r24, 0xC0 ; 192
3ba: 91 05 cpc r25, r1
3bc: 09 f4 brne .+2 ; 0x3c0
3be: 63 c1 rjmp .+710 ; 0x686
3c0: 2a 81 ldd r18, Y+2 ; 0x02
3c2: 3b 81 ldd r19, Y+3 ; 0x03
3c4: 21 3c cpi r18, 0xC1 ; 193
3c6: 31 05 cpc r19, r1
3c8: 3c f4 brge .+14 ; 0x3d8
3ca: 8a 81 ldd r24, Y+2 ; 0x02
3cc: 9b 81 ldd r25, Y+3 ; 0x03
3ce: 88 3b cpi r24, 0xB8 ; 184
3d0: 91 05 cpc r25, r1
3d2: 09 f4 brne .+2 ; 0x3d6
3d4: 3e c1 rjmp .+636 ; 0x652
3d6: 67 c1 rjmp .+718 ; 0x6a6
3d8: 2a 81 ldd r18, Y+2 ; 0x02
3da: 3b 81 ldd r19, Y+3 ; 0x03
3dc: 28 3c cpi r18, 0xC8 ; 200
3de: 31 05 cpc r19, r1
3e0: 09 f4 brne .+2 ; 0x3e4
3e2: 51 c1 rjmp .+674 ; 0x686
3e4: 60 c1 rjmp .+704 ; 0x6a6
{
case TW_START: // A START has transmit to IIC bus
case TW_REP_START: //A REPEAT START has transmit to IIC bus
ucIICMode=IIC_MODE_MASTER_TRANSMIT;
3e6: 82 e0 ldi r24, 0x02 ; 2
3e8: 80 93 7e 00 sts 0x007E, r24
IIC_SLA; //Send SLA+R/W to IIC bus
3ec: 80 91 a7 00 lds r24, 0x00A7
3f0: 88 0f add r24, r24
3f2: 80 93 23 00 sts 0x0023, r24
3f6: 8f ef ldi r24, 0xFF ; 255
3f8: 80 93 7f 00 sts 0x007F, r24
// cbi(TWCR,TWSTA); //Clear TWSTA
TWCR=(_BV(TWEN)|_BV(TWEA)|_BV(TWIE)|_BV(TWINT));
3fc: 85 ec ldi r24, 0xC5 ; 197
3fe: 80 93 56 00 sts 0x0056, r24
break;
402: 54 c1 rjmp .+680 ; 0x6ac
case TW_MT_SLA_ACK:
case TW_MT_DATA_ACK: //Send data to Slave IIC device
if(IIC_Buffer_Out.ucWriteP!=IIC_Buffer_Out.ucReadP)
404: 90 91 a5 00 lds r25, 0x00A5
408: 80 91 a6 00 lds r24, 0x00A6
40c: 98 17 cp r25, r24
40e: a1 f0 breq .+40 ; 0x438
{ // Data transmit not finish
IIC_BUFFER_TO_BUS;
410: a6 ea ldi r26, 0xA6 ; 166
412: b0 e0 ldi r27, 0x00 ; 0
414: 2c 91 ld r18, X
416: 82 2f mov r24, r18
418: 99 27 eor r25, r25
41a: fc 01 movw r30, r24
41c: eb 56 subi r30, 0x6B ; 107
41e: ff 4f sbci r31, 0xFF ; 255
420: 2f 5f subi r18, 0xFF ; 255
422: 2c 93 st X, r18
424: 80 81 ld r24, Z
426: 80 93 23 00 sts 0x0023, r24
42a: 8f ef ldi r24, 0xFF ; 255
42c: 80 93 7f 00 sts 0x007F, r24
TWCR=(_BV(TWEN)|_BV(TWEA)|_BV(TWIE)|_BV(TWINT));
430: 85 ec ldi r24, 0xC5 ; 197
432: 80 93 56 00 sts 0x0056, r24
break;
436: 3a c1 rjmp .+628 ; 0x6ac
}
else
{
IIC_STOP; //Data transmit finish,Release IIC bus
438: 80 91 56 00 lds r24, 0x0056
43c: 85 69 ori r24, 0x95 ; 149
43e: 80 93 56 00 sts 0x0056, r24
442: 10 92 7f 00 sts 0x007F, r1
//Enable user program write a new command to IIC transmit buffer
IIC_Buffer_Out.ucIICBufferStatus.bEnAccess=1;
446: 80 91 a8 00 lds r24, 0x00A8
44a: 81 60 ori r24, 0x01 ; 1
44c: 80 93 a8 00 sts 0x00A8, r24
IIC_Buffer_Out.ucReadP=0;
450: 10 92 a6 00 sts 0x00A6, r1
IIC_Buffer_Out.ucWriteP=0;
454: 10 92 a5 00 sts 0x00A5, r1
ucIICMode=IIC_MODE_SLAVE_RECEIVE;
458: 81 e0 ldi r24, 0x01 ; 1
45a: 80 93 7e 00 sts 0x007E, r24
break;
45e: 26 c1 rjmp .+588 ; 0x6ac
}
case TW_MT_SLA_NACK: //Slave IIC device did not return a NACK during
//address phase
IIC_STOP; //Slave address error,Release IIC bus
460: 80 91 56 00 lds r24, 0x0056
464: 85 69 ori r24, 0x95 ; 149
466: 80 93 56 00 sts 0x0056, r24
46a: 10 92 7f 00 sts 0x007F, r1
//Enable user program write a new command to IIC transmit buffer
ucIICMode=IIC_MODE_SLAVE_RECEIVE;
46e: 81 e0 ldi r24, 0x01 ; 1
470: 80 93 7e 00 sts 0x007E, r24
ucIICError=IIC_ERROR_NOT_ACK_SLA;
474: 81 e8 ldi r24, 0x81 ; 129
476: 80 93 94 00 sts 0x0094, r24
IIC_Buffer_Out.ucIICBufferStatus.bEnAccess=1;
47a: 80 91 a8 00 lds r24, 0x00A8
47e: 81 60 ori r24, 0x01 ; 1
480: 80 93 a8 00 sts 0x00A8, r24
IIC_Buffer_Out.ucReadP=0;
484: 10 92 a6 00 sts 0x00A6, r1
IIC_Buffer_Out.ucWriteP=0;
488: 10 92 a5 00 sts 0x00A5, r1
break;
48c: 0f c1 rjmp .+542 ; 0x6ac
case TW_MT_DATA_NACK: //Slave IIC device did not return a NACK during
//data transfer phase
IIC_STOP; //Data transmit error,Release IIC bus
48e: 80 91 56 00 lds r24, 0x0056
492: 85 69 ori r24, 0x95 ; 149
494: 80 93 56 00 sts 0x0056, r24
498: 10 92 7f 00 sts 0x007F, r1
//Enable user program write a new command to IIC transmit buffer
ucIICMode=IIC_MODE_SLAVE_RECEIVE;
49c: 81 e0 ldi r24, 0x01 ; 1
49e: 80 93 7e 00 sts 0x007E, r24
ucIICError=IIC_ERROR_NOT_ACK_DATA;
4a2: 82 e8 ldi r24, 0x82 ; 130
4a4: 80 93 94 00 sts 0x0094, r24
IIC_Buffer_Out.ucIICBufferStatus.bEnAccess=1;
4a8: 80 91 a8 00 lds r24, 0x00A8
4ac: 81 60 ori r24, 0x01 ; 1
4ae: 80 93 a8 00 sts 0x00A8, r24
IIC_Buffer_Out.ucReadP=0;
4b2: 10 92 a6 00 sts 0x00A6, r1
IIC_Buffer_Out.ucWriteP=0;
4b6: 10 92 a5 00 sts 0x00A5, r1
break;
4ba: f8 c0 rjmp .+496 ; 0x6ac
case TW_MT_ARB_LOST:
//Enable user program write a new command to IIC transmit buffer
if(ucIICMode==IIC_MODE_MASTER_TRANSMIT)
4bc: 80 91 7e 00 lds r24, 0x007E
4c0: 82 30 cpi r24, 0x02 ; 2
4c2: 51 f4 brne .+20 ; 0x4d8
{
IIC_Buffer_Out.ucIICBufferStatus.bEnAccess=1;
4c4: 80 91 a8 00 lds r24, 0x00A8
4c8: 81 60 ori r24, 0x01 ; 1
4ca: 80 93 a8 00 sts 0x00A8, r24
IIC_Buffer_Out.ucReadP=0;
4ce: 10 92 a6 00 sts 0x00A6, r1
IIC_Buffer_Out.ucWriteP=0;
4d2: 10 92 a5 00 sts 0x00A5, r1
4d6: 09 c0 rjmp .+18 ; 0x4ea
}
else
{
IIC_Buffer_In.ucIICBufferStatus.bEnAccess=0;
4d8: 80 91 93 00 lds r24, 0x0093
4dc: 8e 7f andi r24, 0xFE ; 254
4de: 80 93 93 00 sts 0x0093, r24
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -