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

📄 main.lss

📁 DC Power 基于Mega8数控电源
💻 LSS
📖 第 1 页 / 共 5 页
字号:
     590:	ac 01       	movw	r20, r24
     592:	2e 0d       	add	r18, r14
     594:	3f 1d       	adc	r19, r15
     596:	30 93 7e 01 	sts	0x017E, r19
     59a:	20 93 7d 01 	sts	0x017D, r18
		set_target_adc_val(1,set_val_adcUnits[1]);
     59e:	81 e0       	ldi	r24, 0x01	; 1
     5a0:	b9 01       	movw	r22, r18
     5a2:	0d d2       	rcall	.+1050   	; 0x9be <set_target_adc_val>

		// voltage
		lcd_clrscr();
     5a4:	81 e0       	ldi	r24, 0x01	; 1
     5a6:	d3 d0       	rcall	.+422    	; 0x74e <lcd_command>
		int_to_ascii(measured_val[1],out_buf,1,1);
     5a8:	80 91 79 01 	lds	r24, 0x0179
     5ac:	90 91 7a 01 	lds	r25, 0x017A
     5b0:	b6 01       	movw	r22, r12
     5b2:	41 e0       	ldi	r20, 0x01	; 1
     5b4:	21 e0       	ldi	r18, 0x01	; 1
     5b6:	90 dd       	rcall	.-1248   	; 0xd8 <int_to_ascii>
		lcd_puts(out_buf);
     5b8:	c6 01       	movw	r24, r12
     5ba:	ed d0       	rcall	.+474    	; 0x796 <lcd_puts>
		lcd_puts("V ");
     5bc:	80 e6       	ldi	r24, 0x60	; 96
     5be:	90 e0       	ldi	r25, 0x00	; 0
     5c0:	ea d0       	rcall	.+468    	; 0x796 <lcd_puts>
		int_to_ascii(set_val[1],out_buf,1,1);
     5c2:	80 91 75 01 	lds	r24, 0x0175
     5c6:	90 91 76 01 	lds	r25, 0x0176
     5ca:	b6 01       	movw	r22, r12
     5cc:	41 e0       	ldi	r20, 0x01	; 1
     5ce:	21 e0       	ldi	r18, 0x01	; 1
     5d0:	83 dd       	rcall	.-1274   	; 0xd8 <int_to_ascii>
		lcd_putc('[');
     5d2:	8b e5       	ldi	r24, 0x5B	; 91
     5d4:	d5 d0       	rcall	.+426    	; 0x780 <lcd_putc>
		lcd_puts(out_buf);
     5d6:	c6 01       	movw	r24, r12
     5d8:	de d0       	rcall	.+444    	; 0x796 <lcd_puts>
		lcd_putc(']');
     5da:	8d e5       	ldi	r24, 0x5D	; 93
     5dc:	d1 d0       	rcall	.+418    	; 0x780 <lcd_putc>
		if (!is_current_limit()){
     5de:	e7 d1       	rcall	.+974    	; 0x9ae <is_current_limit>
     5e0:	88 23       	and	r24, r24
     5e2:	19 f4       	brne	.+6      	; 0x5ea <__stack+0x18b>
			// put a marker to show which value is currenlty limiting
			lcd_puts("<-");
     5e4:	83 e6       	ldi	r24, 0x63	; 99
     5e6:	90 e0       	ldi	r25, 0x00	; 0
     5e8:	d6 d0       	rcall	.+428    	; 0x796 <lcd_puts>
		}

		//check_i2c_interface();

		// current
		lcd_gotoxy(0,1);
     5ea:	80 e0       	ldi	r24, 0x00	; 0
     5ec:	61 e0       	ldi	r22, 0x01	; 1
     5ee:	c1 d0       	rcall	.+386    	; 0x772 <lcd_gotoxy>
		int_to_ascii(measured_val[0],out_buf,2,0);
     5f0:	80 91 77 01 	lds	r24, 0x0177
     5f4:	90 91 78 01 	lds	r25, 0x0178
     5f8:	b6 01       	movw	r22, r12
     5fa:	42 e0       	ldi	r20, 0x02	; 2
     5fc:	20 e0       	ldi	r18, 0x00	; 0
     5fe:	6c dd       	rcall	.-1320   	; 0xd8 <int_to_ascii>
		lcd_puts(out_buf);
     600:	c6 01       	movw	r24, r12
     602:	c9 d0       	rcall	.+402    	; 0x796 <lcd_puts>
		lcd_puts("A ");
     604:	86 e6       	ldi	r24, 0x66	; 102
     606:	90 e0       	ldi	r25, 0x00	; 0
     608:	c6 d0       	rcall	.+396    	; 0x796 <lcd_puts>
		int_to_ascii(set_val[0],out_buf,2,0);
     60a:	80 91 73 01 	lds	r24, 0x0173
     60e:	90 91 74 01 	lds	r25, 0x0174
     612:	b6 01       	movw	r22, r12
     614:	42 e0       	ldi	r20, 0x02	; 2
     616:	20 e0       	ldi	r18, 0x00	; 0
     618:	5f dd       	rcall	.-1346   	; 0xd8 <int_to_ascii>
		lcd_putc('[');
     61a:	8b e5       	ldi	r24, 0x5B	; 91
     61c:	b1 d0       	rcall	.+354    	; 0x780 <lcd_putc>
		lcd_puts(out_buf);
     61e:	c6 01       	movw	r24, r12
     620:	ba d0       	rcall	.+372    	; 0x796 <lcd_puts>
		lcd_putc(']');
     622:	8d e5       	ldi	r24, 0x5D	; 93
     624:	ad d0       	rcall	.+346    	; 0x780 <lcd_putc>
		if (is_current_limit()){
     626:	c3 d1       	rcall	.+902    	; 0x9ae <is_current_limit>
     628:	88 23       	and	r24, r24
     62a:	19 f0       	breq	.+6      	; 0x632 <__stack+0x1d3>
			// put a marker to show which value is currenlty limiting
			lcd_puts("<-");
     62c:	83 e6       	ldi	r24, 0x63	; 99
     62e:	90 e0       	ldi	r25, 0x00	; 0
     630:	b2 d0       	rcall	.+356    	; 0x796 <lcd_puts>
		//lcd_puts(out_buf);
	//	check_i2c_interface();

		// the buttons must be responsive but they must not 
		// scroll too fast if pressed permanently
		if (check_buttons()==0){
     632:	29 de       	rcall	.-942    	; 0x286 <check_buttons>
     634:	88 23       	and	r24, r24
     636:	91 f4       	brne	.+36     	; 0x65c <__stack+0x1fd>
     638:	84 e6       	ldi	r24, 0x64	; 100
     63a:	90 e0       	ldi	r25, 0x00	; 0
     63c:	f5 01       	movw	r30, r10
     63e:	31 97       	sbiw	r30, 0x01	; 1
     640:	f1 f7       	brne	.-4      	; 0x63e <__stack+0x1df>
        // we use a calibrated macro. This is more
        // accurate and not so much compiler dependent
        // as self made code.
        while(ms){
                _delay_ms(0.96);
                ms--;
     642:	01 97       	sbiw	r24, 0x01	; 1
/* delay for a minimum of <ms> */
{
        // we use a calibrated macro. This is more
        // accurate and not so much compiler dependent
        // as self made code.
        while(ms){
     644:	d9 f7       	brne	.-10     	; 0x63c <__stack+0x1dd>
		// the buttons must be responsive but they must not 
		// scroll too fast if pressed permanently
		if (check_buttons()==0){
			// no buttons pressed
			delay_ms(100);
			bpress=0;
     646:	10 92 72 01 	sts	0x0172, r1
			//check_i2c_interface();
			check_buttons();
     64a:	1d de       	rcall	.-966    	; 0x286 <check_buttons>
     64c:	86 e9       	ldi	r24, 0x96	; 150
     64e:	90 e0       	ldi	r25, 0x00	; 0
     650:	f5 01       	movw	r30, r10
     652:	31 97       	sbiw	r30, 0x01	; 1
     654:	f1 f7       	brne	.-4      	; 0x652 <__stack+0x1f3>
        // we use a calibrated macro. This is more
        // accurate and not so much compiler dependent
        // as self made code.
        while(ms){
                _delay_ms(0.96);
                ms--;
     656:	01 97       	sbiw	r24, 0x01	; 1
/* delay for a minimum of <ms> */
{
        // we use a calibrated macro. This is more
        // accurate and not so much compiler dependent
        // as self made code.
        while(ms){
     658:	d9 f7       	brne	.-10     	; 0x650 <__stack+0x1f1>
     65a:	f8 ce       	rjmp	.-528    	; 0x44c <main+0x9c>
			//check_i2c_interface();
			check_buttons();
			delay_ms(150);
		}else{
			// button press
			if (bpress > 11){
     65c:	80 91 72 01 	lds	r24, 0x0172
     660:	8c 30       	cpi	r24, 0x0C	; 12
     662:	78 f0       	brcs	.+30     	; 0x682 <__stack+0x223>
     664:	8a e0       	ldi	r24, 0x0A	; 10
     666:	90 e0       	ldi	r25, 0x00	; 0
     668:	f5 01       	movw	r30, r10
     66a:	31 97       	sbiw	r30, 0x01	; 1
     66c:	f1 f7       	brne	.-4      	; 0x66a <__stack+0x20b>
        // we use a calibrated macro. This is more
        // accurate and not so much compiler dependent
        // as self made code.
        while(ms){
                _delay_ms(0.96);
                ms--;
     66e:	01 97       	sbiw	r24, 0x01	; 1
/* delay for a minimum of <ms> */
{
        // we use a calibrated macro. This is more
        // accurate and not so much compiler dependent
        // as self made code.
        while(ms){
     670:	d9 f7       	brne	.-10     	; 0x668 <__stack+0x209>
     672:	88 e2       	ldi	r24, 0x28	; 40
     674:	90 e0       	ldi	r25, 0x00	; 0
     676:	f5 01       	movw	r30, r10
     678:	31 97       	sbiw	r30, 0x01	; 1
     67a:	f1 f7       	brne	.-4      	; 0x678 <__stack+0x219>
                _delay_ms(0.96);
                ms--;
     67c:	01 97       	sbiw	r24, 0x01	; 1
/* delay for a minimum of <ms> */
{
        // we use a calibrated macro. This is more
        // accurate and not so much compiler dependent
        // as self made code.
        while(ms){
     67e:	d9 f7       	brne	.-10     	; 0x676 <__stack+0x217>
     680:	e5 ce       	rjmp	.-566    	; 0x44c <main+0x9c>
				// somebody pressed permanetly the button=>scroll fast
				delay_ms(10);
			//	check_i2c_interface();
				delay_ms(40);
			}else{
				bpress++;
     682:	8f 5f       	subi	r24, 0xFF	; 255
     684:	80 93 72 01 	sts	0x0172, r24
     688:	84 e6       	ldi	r24, 0x64	; 100
     68a:	90 e0       	ldi	r25, 0x00	; 0
     68c:	f5 01       	movw	r30, r10
     68e:	31 97       	sbiw	r30, 0x01	; 1
     690:	f1 f7       	brne	.-4      	; 0x68e <__stack+0x22f>
        // we use a calibrated macro. This is more
        // accurate and not so much compiler dependent
        // as self made code.
        while(ms){
                _delay_ms(0.96);
                ms--;
     692:	01 97       	sbiw	r24, 0x01	; 1
/* delay for a minimum of <ms> */
{
        // we use a calibrated macro. This is more
        // accurate and not so much compiler dependent
        // as self made code.
        while(ms){
     694:	d9 f7       	brne	.-10     	; 0x68c <__stack+0x22d>
     696:	86 e9       	ldi	r24, 0x96	; 150
     698:	90 e0       	ldi	r25, 0x00	; 0
     69a:	f5 01       	movw	r30, r10
     69c:	31 97       	sbiw	r30, 0x01	; 1
     69e:	f1 f7       	brne	.-4      	; 0x69c <__stack+0x23d>
                _delay_ms(0.96);
                ms--;
     6a0:	01 97       	sbiw	r24, 0x01	; 1
/* delay for a minimum of <ms> */
{
        // we use a calibrated macro. This is more
        // accurate and not so much compiler dependent
        // as self made code.
        while(ms){
     6a2:	d9 f7       	brne	.-10     	; 0x69a <__stack+0x23b>
     6a4:	d3 ce       	rjmp	.-602    	; 0x44c <main+0x9c>

000006a6 <lcd_delay_ms>:
     6a6:	20 ec       	ldi	r18, 0xC0	; 192
     6a8:	33 e0       	ldi	r19, 0x03	; 3
     6aa:	04 c0       	rjmp	.+8      	; 0x6b4 <lcd_delay_ms+0xe>
     6ac:	f9 01       	movw	r30, r18
     6ae:	31 97       	sbiw	r30, 0x01	; 1
     6b0:	f1 f7       	brne	.-4      	; 0x6ae <lcd_delay_ms+0x8>
        // we use a calibrated macro. This is more
        // accurate and not so much compiler dependent
        // as self made code.
        while(ms){
                _delay_ms(0.96);
                ms--;
     6b2:	01 97       	sbiw	r24, 0x01	; 1
/* delay for a minimum of <ms> */
{
        // we use a calibrated macro. This is more
        // accurate and not so much compiler dependent
        // as self made code.
        while(ms){
     6b4:	00 97       	sbiw	r24, 0x00	; 0
     6b6:	d1 f7       	brne	.-12     	; 0x6ac <lcd_delay_ms+0x6>
                _delay_ms(0.96);
                ms--;
        }
}
     6b8:	08 95       	ret

000006ba <lcd_out_high>:
	if (d&0x01)  sbi(LCD_DATA_PORT_D4,LCD_DATA_PIN_D4);
		else cbi(LCD_DATA_PORT_D4,LCD_DATA_PIN_D4); 
}
static void lcd_out_high(u08 d)
{	/* output high nibble */ 
	if (d&0x80)  sbi(LCD_DATA_PORT_D7,LCD_DATA_PIN_D7);
     6ba:	87 ff       	sbrs	r24, 7
     6bc:	02 c0       	rjmp	.+4      	; 0x6c2 <lcd_out_high+0x8>
     6be:	c7 9a       	sbi	0x18, 7	; 24
     6c0:	01 c0       	rjmp	.+2      	; 0x6c4 <lcd_out_high+0xa>
		else cbi(LCD_DATA_PORT_D7,LCD_DATA_PIN_D7);
     6c2:	c7 98       	cbi	0x18, 7	; 24
	if (d&0x40)  sbi(LCD_DATA_PORT_D6,LCD_DATA_PIN_D6);
     6c4:	86 ff       	sbrs	r24, 6
     6c6:	02 c0       	rjmp	.+4      	; 0x6cc <lcd_out_high+0x12>
     6c8:	c2 9a       	sbi	0x18, 2	; 24
     6ca:	01 c0       	rjmp	.+2      	; 0x6ce <lcd_out_high+0x14>
		else cbi(LCD_DATA_PORT_D6,LCD_DATA_PIN_D6);
     6cc:	c2 98       	cbi	0x18, 2	; 24
	if (d&0x20)  sbi(LCD_DATA_PORT_D5,LCD_DATA_PIN_D5);
     6ce:	85 ff       	sbrs	r24, 5
     6d0:	02 c0       	rjmp	.+4      	; 0x6d6 <lcd_out_high+0x1c>
     6d2:	c1 9a       	sbi	0x18, 1	; 24
     6d4:	01 c0       	rjmp	.+2      	; 0x6d8 <lcd_out_high+0x1e>
		else cbi(LCD_DATA_PORT_D5,LCD_DATA_PIN_D5);
     6d6:	c1 98       	cbi	0x18, 1	; 24
	if (d&0x10)  sbi(LCD_DATA_PORT_D4,LCD_DATA_PIN_D4);
     6d8:	84 ff       	sbrs	r24, 4
     6da:	02 c0       	rjmp	.+4      	; 0x6e0 <lcd_out_high+0x26>
     6dc:	c0 9a       	sbi	0x18, 0	; 24
     6de:	08 95       	ret
		else cbi(LCD_DATA_PORT_D4,LCD_DATA_PIN_D4); 
     6e0:	c0 98       	cbi	0x18, 0	; 24
     6e2:	08 95       	ret

000006e4 <lcd_write>:
	lcd_e_low();
}


static void lcd_write(u08 data, u08 rs)
{
     6e4:	0f 93       	push	r16
     6e6:	1f 93       	push	r17
     6e8:	18 2f       	mov	r17, r24
     6ea:	06 2f       	mov	r16, r22
	/* configure data pins as output */
	lcd_data_port_out();
     6ec:	bf 9a       	sbi	0x17, 7	; 23
     6ee:	ba 9a       	sbi	0x17, 2	; 23
     6f0:	b9 9a       	sbi	0x17, 1	; 23
     6f2:	b8 9a       	sbi	0x17, 0	; 23

	/* output high nibble first */

	lcd_out_high(data);
     6f4:	e2 df       	rcall	.-60     	; 0x6ba <lcd_out_high>

	if (rs)
     6f6:	00 23       	and	r16, r16
     6f8:	11 f0       	breq	.+4      	; 0x6fe <lcd_write+0x1a>
		lcd_data_mode();	/* RS=1: write data            */
     6fa:	c6 9a       	sbi	0x18, 6	; 24
     6fc:	01 c0       	rjmp	.+2      	; 0x700 <lcd_write+0x1c>
	else
		lcd_cmd_mode();	/* RS=0: write instruction     */
     6fe:	c6 98       	cbi	0x18, 6	; 24
}

static void lcd_e_toggle(void)
/* toggle Enable Pin */
{
	lcd_e_high();
     700:	c4 9a       	sbi	0x18, 4	; 24
    can be achieved.
*/
void
_delay_loop_1(uint8_t __count)
{
	__asm__ volatile (
     702:	84 e0       	ldi	r24, 0x04	; 4
     704:	8a 95       	dec	r24
     706:	f1 f7       	brne	.-4      	; 0x704 <lcd_write+0x20>
	_delay_us(3);
	lcd_e_low();
     708:	c4 98       	cbi	0x18, 4	; 24
        }

⌨️ 快捷键说明

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