پاسخ : افت ولتاژ دو سر موتور DC
با سلام دوست عزیز
واقعا
با سلام دوست عزیز
واقعا

همیشه در قلبم زنده ی استاد تحیری

[URL=https://www.eca.ir/forums/usertag.php?do=list&action=hash&hash=include]#include[/URL] <tiny2313.h>
[URL=https://www.eca.ir/forums/usertag.php?do=list&action=hash&hash=include]#include[/URL] <delay.h>
void main(void)
{
[URL=https://www.eca.ir/forums/usertag.php?do=list&action=hash&hash=pragma]#pragma[/URL] optsize-
CLKPR=(1<<CLKPCE);
CLKPR=(0<<CLKPCE) | (0<<CLKPS3) | (0<<CLKPS2) |
(0<<CLKPS1) | (0<<CLKPS0);
[URL=https://www.eca.ir/forums/usertag.php?do=list&action=hash&hash=ifdef]#ifdef[/URL] _OPTIMIZE_SIZE_
[URL=https://www.eca.ir/forums/usertag.php?do=list&action=hash&hash=pragma]#pragma[/URL] optsize+
[URL=https://www.eca.ir/forums/usertag.php?do=list&action=hash&hash=endif]#endif[/URL]
DDRA=(0<<DDA2) | (0<<DDA1) | (0<<DDA0);
PORTA=(0<<PORTA2) | (0<<PORTA1) | (0<<PORTA0);
DDRB=(0<<DDB7) | (0<<DDB6) | (0<<DDB5) | (0<<DDB4) | (0<<DDB3) |
(0<<DDB2) | (0<<DDB1) | (0<<DDB0);
PORTB=(0<<PORTB7) | (0<<PORTB6) | (0<<PORTB5) | (0<<PORTB4) |
(0<<PORTB3) | (0<<PORTB2) | (0<<PORTB1) | (0<<PORTB0);
DDRD=(0<<DDD6) | (1<<DDD5) | (1<<DDD4) | (1<<DDD3) | (1<<DDD2)
| (1<<DDD1) | (1<<DDD0);
PORTD=(0<<PORTD6) | (0<<PORTD5) | (0<<PORTD4) | (0<<PORTD3) |
(0<<PORTD2) | (0<<PORTD1) | (0<<PORTD0);
while (1)
{
PORTD.0 =1;delay_ms(50);PORTD.0 =0;delay_us(50);
PORTD.1 =1;delay_ms(50);PORTD.1 =0;delay_us(50);
PORTD.2 =1;delay_ms(50);PORTD.2 =0;delay_us(50);
}
}

[URL=https://www.eca.ir/forums/usertag.php?do=list&action=hash&hash=include]#include[/URL] <tiny2313.h>
[URL=https://www.eca.ir/forums/usertag.php?do=list&action=hash&hash=include]#include[/URL] <delay.h>
void main(void)
{
[URL=https://www.eca.ir/forums/usertag.php?do=list&action=hash&hash=pragma]#pragma[/URL] optsize-
CLKPR=(1<<CLKPCE);
CLKPR=(0<<CLKPCE) | (0<<CLKPS3) | (0<<CLKPS2) |
(0<<CLKPS1) | (0<<CLKPS0);
[URL=https://www.eca.ir/forums/usertag.php?do=list&action=hash&hash=ifdef]#ifdef[/URL] _OPTIMIZE_SIZE_
[URL=https://www.eca.ir/forums/usertag.php?do=list&action=hash&hash=pragma]#pragma[/URL] optsize+
[URL=https://www.eca.ir/forums/usertag.php?do=list&action=hash&hash=endif]#endif[/URL]
DDRA=(0<<DDA2) | (0<<DDA1) | (0<<DDA0);
PORTA=(0<<PORTA2) | (0<<PORTA1) | (0<<PORTA0);
DDRB=(0<<DDB7) | (0<<DDB6) | (0<<DDB5) | (0<<DDB4) | (0<<DDB3) |
(0<<DDB2) | (0<<DDB1) | (0<<DDB0);
PORTB=(0<<PORTB7) | (0<<PORTB6) | (0<<PORTB5) | (0<<PORTB4) |
(0<<PORTB3) | (0<<PORTB2) | (0<<PORTB1) | (0<<PORTB0);
DDRD=(0<<DDD6) | (1<<DDD5) | (1<<DDD4) | (1<<DDD3) | (1<<DDD2)
| (1<<DDD1) | (1<<DDD0);
PORTD=(0<<PORTD6) | (0<<PORTD5) | (0<<PORTD4) | (0<<PORTD3) |
(0<<PORTD2) | (0<<PORTD1) | (0<<PORTD0);
while (1)
{
PORTD.0 =1;delay_ms(50);PORTD.0 =0;delay_us(50);
PORTD.1 =1;delay_ms(50);PORTD.1 =0;delay_us(50);
PORTD.2 =1;delay_ms(50);PORTD.2 =0;delay_us(50);
}
}

دیدگاه