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

📄 main.lss

📁 DC Power 基于Mega8数控电源
💻 LSS
📖 第 1 页 / 共 5 页
字号:
     1a4:	ff 27       	eor	r31, r31
     1a6:	e7 fd       	sbrc	r30, 7
     1a8:	f0 95       	com	r31
     1aa:	51 50       	subi	r21, 0x01	; 1
     1ac:	e2 0f       	add	r30, r18
     1ae:	f3 1f       	adc	r31, r19
	while(j<decimalpoint_pos){
		j++;
		chbuf[j]='0';
     1b0:	80 e3       	ldi	r24, 0x30	; 48
     1b2:	02 c0       	rjmp	.+4      	; 0x1b8 <int_to_ascii+0xe0>
		}
	}
	chbuf[j]=(char)48+inum; // most significant digit
	decimalpoint_pos--;
	while(j<decimalpoint_pos){
		j++;
     1b4:	5f 5f       	subi	r21, 0xFF	; 255
		chbuf[j]='0';
     1b6:	81 93       	st	Z+, r24
			j++;
		}
	}
	chbuf[j]=(char)48+inum; // most significant digit
	decimalpoint_pos--;
	while(j<decimalpoint_pos){
     1b8:	54 17       	cp	r21, r20
     1ba:	e4 f3       	brlt	.-8      	; 0x1b4 <int_to_ascii+0xdc>
		j++;
		chbuf[j]='0';
	}
	if (spacepadd && j > (decimalpoint_pos+2)){
     1bc:	bb 20       	and	r11, r11
     1be:	69 f0       	breq	.+26     	; 0x1da <int_to_ascii+0x102>
     1c0:	25 2f       	mov	r18, r21
     1c2:	33 27       	eor	r19, r19
     1c4:	27 fd       	sbrc	r18, 7
     1c6:	30 95       	com	r19
     1c8:	84 2f       	mov	r24, r20
     1ca:	99 27       	eor	r25, r25
     1cc:	87 fd       	sbrc	r24, 7
     1ce:	90 95       	com	r25
     1d0:	02 96       	adiw	r24, 0x02	; 2
     1d2:	82 17       	cp	r24, r18
     1d4:	93 07       	cpc	r25, r19
     1d6:	0c f4       	brge	.+2      	; 0x1da <int_to_ascii+0x102>
     1d8:	bb 24       	eor	r11, r11
		// no leading space padding needed
		spacepadd=0;
	}
	if(decimalpoint_pos==j){
     1da:	45 17       	cp	r20, r21
     1dc:	a9 f4       	brne	.+42     	; 0x208 <int_to_ascii+0x130>
		j++;
     1de:	95 2f       	mov	r25, r21
     1e0:	9f 5f       	subi	r25, 0xFF	; 255
		chbuf[j]='.';
     1e2:	e9 2f       	mov	r30, r25
     1e4:	ff 27       	eor	r31, r31
     1e6:	e7 fd       	sbrc	r30, 7
     1e8:	f0 95       	com	r31
     1ea:	de 01       	movw	r26, r28
     1ec:	11 96       	adiw	r26, 0x01	; 1
     1ee:	ea 0f       	add	r30, r26
     1f0:	fb 1f       	adc	r31, r27
     1f2:	8e e2       	ldi	r24, 0x2E	; 46
     1f4:	80 83       	st	Z, r24
		j++;
     1f6:	5e 5f       	subi	r21, 0xFE	; 254
		chbuf[j]='0'; // leading zero
     1f8:	85 2f       	mov	r24, r21
     1fa:	99 27       	eor	r25, r25
     1fc:	87 fd       	sbrc	r24, 7
     1fe:	90 95       	com	r25
     200:	a8 0f       	add	r26, r24
     202:	b9 1f       	adc	r27, r25
     204:	80 e3       	ldi	r24, 0x30	; 48
     206:	8c 93       	st	X, r24
	}
	if (spacepadd){
     208:	bb 20       	and	r11, r11
     20a:	49 f0       	breq	.+18     	; 0x21e <int_to_ascii+0x146>
		j++;
     20c:	5f 5f       	subi	r21, 0xFF	; 255
		chbuf[j]=' '; // leading space padding: "9.50" becomes " 9.50"
     20e:	e5 2f       	mov	r30, r21
     210:	ff 27       	eor	r31, r31
     212:	e7 fd       	sbrc	r30, 7
     214:	f0 95       	com	r31
     216:	ec 0f       	add	r30, r28
     218:	fd 1f       	adc	r31, r29
     21a:	80 e2       	ldi	r24, 0x20	; 32
     21c:	81 83       	std	Z+1, r24	; 0x01
     21e:	85 2f       	mov	r24, r21
     220:	99 27       	eor	r25, r25
     222:	87 fd       	sbrc	r24, 7
     224:	90 95       	com	r25
     226:	de 01       	movw	r26, r28
     228:	11 96       	adiw	r26, 0x01	; 1
     22a:	a8 0f       	add	r26, r24
     22c:	b9 1f       	adc	r27, r25
     22e:	20 e0       	ldi	r18, 0x00	; 0
     230:	30 e0       	ldi	r19, 0x00	; 0
     232:	08 c0       	rjmp	.+16     	; 0x244 <int_to_ascii+0x16c>
	}
	// now reverse the order 
	i=0;
	while(j>=0){
		outbuf[i]=chbuf[j];
     234:	f3 01       	movw	r30, r6
     236:	e2 0f       	add	r30, r18
     238:	f3 1f       	adc	r31, r19
     23a:	8c 91       	ld	r24, X
     23c:	80 83       	st	Z, r24
     23e:	2f 5f       	subi	r18, 0xFF	; 255
     240:	3f 4f       	sbci	r19, 0xFF	; 255
     242:	11 97       	sbiw	r26, 0x01	; 1
     244:	e2 2f       	mov	r30, r18
// Convert a integer which is representing a float into a string.
// decimalpoint_pos sets the decimal point after 2 pos: e.g 74 becomes "0.74"
// The integer may not be larger than 10000.
// The integer must be a positive number.
// spacepadd can be used to add a leading speace if number is less than 10
static void int_to_ascii(int inum,char *outbuf,signed char decimalpoint_pos,signed char spacepadd){
     246:	85 2f       	mov	r24, r21
     248:	82 1b       	sub	r24, r18
		j++;
		chbuf[j]=' '; // leading space padding: "9.50" becomes " 9.50"
	}
	// now reverse the order 
	i=0;
	while(j>=0){
     24a:	87 ff       	sbrs	r24, 7
     24c:	f3 cf       	rjmp	.-26     	; 0x234 <int_to_ascii+0x15c>
		outbuf[i]=chbuf[j];
		j--;
		i++;
	}
	outbuf[i]='\0';
     24e:	ff 27       	eor	r31, r31
     250:	e7 fd       	sbrc	r30, 7
     252:	f0 95       	com	r31
     254:	e6 0d       	add	r30, r6
     256:	f7 1d       	adc	r31, r7
     258:	10 82       	st	Z, r1
}
     25a:	28 96       	adiw	r28, 0x08	; 8
     25c:	0f b6       	in	r0, 0x3f	; 63
     25e:	f8 94       	cli
     260:	de bf       	out	0x3e, r29	; 62
     262:	0f be       	out	0x3f, r0	; 63
     264:	cd bf       	out	0x3d, r28	; 61
     266:	cf 91       	pop	r28
     268:	df 91       	pop	r29
     26a:	1f 91       	pop	r17
     26c:	0f 91       	pop	r16
     26e:	ff 90       	pop	r15
     270:	ef 90       	pop	r14
     272:	df 90       	pop	r13
     274:	cf 90       	pop	r12
     276:	bf 90       	pop	r11
     278:	af 90       	pop	r10
     27a:	9f 90       	pop	r9
     27c:	8f 90       	pop	r8
     27e:	7f 90       	pop	r7
     280:	6f 90       	pop	r6
     282:	5f 90       	pop	r5
     284:	08 95       	ret

00000286 <check_buttons>:
	}
	delay_ms(200);
}

// check the keyboard
static unsigned char check_buttons(void){
     286:	0f 93       	push	r16
     288:	1f 93       	push	r17
     28a:	cf 93       	push	r28
     28c:	df 93       	push	r29
	if (check_u_button(&(set_val[1]))){
     28e:	85 e7       	ldi	r24, 0x75	; 117
     290:	91 e0       	ldi	r25, 0x01	; 1
     292:	11 d3       	rcall	.+1570   	; 0x8b6 <check_u_button>
     294:	88 23       	and	r24, r24
     296:	79 f0       	breq	.+30     	; 0x2b6 <check_buttons+0x30>
		if(set_val[1]>U_MAX){
     298:	80 91 75 01 	lds	r24, 0x0175
     29c:	90 91 76 01 	lds	r25, 0x0176
     2a0:	8d 3d       	cpi	r24, 0xDD	; 221
     2a2:	91 05       	cpc	r25, r1
     2a4:	0c f4       	brge	.+2      	; 0x2a8 <check_buttons+0x22>
     2a6:	7e c0       	rjmp	.+252    	; 0x3a4 <check_buttons+0x11e>
			set_val[1]=U_MAX;
     2a8:	8c ed       	ldi	r24, 0xDC	; 220
     2aa:	90 e0       	ldi	r25, 0x00	; 0
     2ac:	90 93 76 01 	sts	0x0176, r25
     2b0:	80 93 75 01 	sts	0x0175, r24
     2b4:	77 c0       	rjmp	.+238    	; 0x3a4 <check_buttons+0x11e>
		}
		return(1);
	}
	if (check_i_button(&(set_val[0]))){
     2b6:	83 e7       	ldi	r24, 0x73	; 115
     2b8:	91 e0       	ldi	r25, 0x01	; 1
     2ba:	22 d3       	rcall	.+1604   	; 0x900 <check_i_button>
     2bc:	88 23       	and	r24, r24
     2be:	79 f0       	breq	.+30     	; 0x2de <check_buttons+0x58>
		if(set_val[0]>I_MAX){
     2c0:	80 91 73 01 	lds	r24, 0x0173
     2c4:	90 91 74 01 	lds	r25, 0x0174
     2c8:	8b 3f       	cpi	r24, 0xFB	; 251
     2ca:	91 05       	cpc	r25, r1
     2cc:	0c f4       	brge	.+2      	; 0x2d0 <check_buttons+0x4a>
     2ce:	6a c0       	rjmp	.+212    	; 0x3a4 <check_buttons+0x11e>
			set_val[0]=I_MAX;
     2d0:	8a ef       	ldi	r24, 0xFA	; 250
     2d2:	90 e0       	ldi	r25, 0x00	; 0
     2d4:	90 93 74 01 	sts	0x0174, r25
     2d8:	80 93 73 01 	sts	0x0173, r24
     2dc:	63 c0       	rjmp	.+198    	; 0x3a4 <check_buttons+0x11e>
		}
		return(1);
	}
	if (check_store_button()){
     2de:	35 d3       	rcall	.+1642   	; 0x94a <check_store_button>
     2e0:	88 23       	and	r24, r24
     2e2:	09 f4       	brne	.+2      	; 0x2e6 <check_buttons+0x60>
     2e4:	60 c0       	rjmp	.+192    	; 0x3a6 <check_buttons+0x120>
}

static void store_permanent(void){
	int tmp;
	signed char changeflag=1;
	lcd_clrscr();
     2e6:	81 e0       	ldi	r24, 0x01	; 1
     2e8:	32 d2       	rcall	.+1124   	; 0x74e <lcd_command>
/** \ingroup avr_eeprom
    Read one byte from EEPROM address \a __p.
 */
__ATTR_PURE__ static __inline__ uint8_t eeprom_read_byte (const uint8_t *__p)
{
    do {} while (!eeprom_is_ready ());
     2ea:	e1 99       	sbic	0x1c, 1	; 28
     2ec:	fe cf       	rjmp	.-4      	; 0x2ea <check_buttons+0x64>
#if E2END <= 0xFF
    EEARL = (size_t)__p;
#else
    EEAR = (size_t)__p;
     2ee:	1f ba       	out	0x1f, r1	; 31
     2f0:	1e ba       	out	0x1e, r1	; 30
    /* Use inline assembly below as some AVRs have problems with accessing
    EECR with STS instructions. For example, see errata for ATmega64. 
    The code below also assumes that EECR and EEDR are in the I/O space.
    */
    uint8_t __result;
    __asm__ __volatile__
     2f2:	e0 9a       	sbi	0x1c, 0	; 28
     2f4:	8d b3       	in	r24, 0x1d	; 29
	if (eeprom_read_byte((uint8_t *)0x0) == 19){
     2f6:	83 31       	cpi	r24, 0x13	; 19
     2f8:	c9 f4       	brne	.+50     	; 0x32c <check_buttons+0xa6>
    Read one 16-bit word (little endian) from EEPROM address \a __p.
 */
__ATTR_PURE__ static __inline__ uint16_t eeprom_read_word (const uint16_t *__p)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
    return __eerd_word (__p, eeprom_read_byte);
     2fa:	84 e0       	ldi	r24, 0x04	; 4
     2fc:	90 e0       	ldi	r25, 0x00	; 0
     2fe:	6e e4       	ldi	r22, 0x4E	; 78
     300:	70 e0       	ldi	r23, 0x00	; 0
     302:	ac d9       	rcall	.-3240   	; 0xfffff65c <__eeprom_end+0xff7ef65c>
     304:	8c 01       	movw	r16, r24
		changeflag=0;
		// ok magic number matches accept values
		tmp=eeprom_read_word((uint16_t *)0x04);
		if (tmp != set_val[1]){
     306:	c0 91 75 01 	lds	r28, 0x0175
     30a:	d0 91 76 01 	lds	r29, 0x0176
     30e:	82 e0       	ldi	r24, 0x02	; 2
     310:	90 e0       	ldi	r25, 0x00	; 0
     312:	6e e4       	ldi	r22, 0x4E	; 78
     314:	70 e0       	ldi	r23, 0x00	; 0
     316:	a2 d9       	rcall	.-3260   	; 0xfffff65c <__eeprom_end+0xff7ef65c>
			changeflag=1;
		}
		tmp=eeprom_read_word((uint16_t *)0x02);
		if (tmp != set_val[0]){
     318:	20 91 73 01 	lds	r18, 0x0173
     31c:	30 91 74 01 	lds	r19, 0x0174
     320:	82 17       	cp	r24, r18
     322:	93 07       	cpc	r25, r19
     324:	19 f4       	brne	.+6      	; 0x32c <check_buttons+0xa6>
			changeflag=1;
		}
	}
	if (changeflag){
     326:	0c 17       	cp	r16, r28
     328:	1d 07       	cpc	r17, r29
     32a:	09 f1       	breq	.+66     	; 0x36e <check_buttons+0xe8>
		lcd_puts_P("setting stored");
     32c:	85 e5       	ldi	r24, 0x55	; 85
     32e:	90 e0       	ldi	r25, 0x00	; 0
     330:	3e d2       	rcall	.+1148   	; 0x7ae <lcd_puts_p>
/** \ingroup avr_eeprom
    Write a byte \a __value to EEPROM address \a __p.
 */
static __inline__ void eeprom_write_byte (uint8_t *__p, uint8_t __value)
{
    do {} while (!eeprom_is_ready ());
     332:	e1 99       	sbic	0x1c, 1	; 28
     334:	fe cf       	rjmp	.-4      	; 0x332 <check_buttons+0xac>
#endif

#if	E2END <= 0xFF
    EEARL = (size_t)__p;
#else
    EEAR = (size_t)__p;
     336:	1f ba       	out	0x1f, r1	; 31
     338:	1e ba       	out	0x1e, r1	; 30
#endif
    EEDR = __value;
     33a:	83 e1       	ldi	r24, 0x13	; 19
     33c:	8d bb       	out	0x1d, r24	; 29

    __asm__ __volatile__ (
     33e:	0f b6       	in	r0, 0x3f	; 63
     340:	f8 94       	cli
     342:	e2 9a       	sbi	0x1c, 2	; 28
     344:	e1 9a       	sbi	0x1c, 1	; 28
     346:	0f be       	out	0x3f, r0	; 63
    Write a word \a __value to EEPROM address \a __p.
 */
static __inline__ void eeprom_write_word (uint16_t *__p, uint16_t __value)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
    __eewr_word (__p, __value, eeprom_write_byte);
     348:	60 91 73 01 	lds	r22, 0x0173
     34c:	70 91 74 01 	lds	r23, 0x0174
     350:	82 e0       	ldi	r24, 0x02	; 2
     352:	90 e0       	ldi	r25, 0x00	; 0
     354:	46 e5       	ldi	r20, 0x56	; 86
     356:	50 e0       	ldi	r21, 0x00	; 0
     358:	97 d9       	rcall	.-3282   	; 0xfffff688 <__eeprom_end+0xff7ef688>
		eeprom_write_byte((uint8_t *)0x0,19); // magic number
		eeprom_write_word((uint16_t *)0x02,set_val[0]);
		eeprom_write_word((uint16_t *)0x04,set_val[1]);
	}else{
		if (bpress> 5){
     35a:	60 91 75 01 	lds	r22, 0x0175
     35e:	70 91 76 01 	lds	r23, 0x0176
     362:	84 e0       	ldi	r24, 0x04	; 4
     364:	90 e0       	ldi	r25, 0x00	; 0
     366:	46 e5       	ldi	r20, 0x56	; 86
     368:	50 e0       	ldi	r21, 0x00	; 0
     36a:	8e d9       	rcall	.-3300   	; 0xfffff688 <__eeprom_end+0xff7ef688>
     36c:	10 c0       	rjmp	.+32     	; 0x38e <check_buttons+0x108>
     36e:	80 91 72 01 	lds	r24, 0x0172
     372:	86 30       	cpi	r24, 0x06	; 6
     374:	48 f0       	brcs	.+18     	; 0x388 <check_buttons+0x102>
			// display software version after long press
			lcd_puts_P(SWVERSION);

⌨️ 快捷键说明

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