#include<avr/io.h>
#include<util/delay.h>
#include<compat/deprecated.h>
int main(void)
{
DDRC=0xFF;
PORTC=0xFF;
}
...........
#include<avr/io.h>
#include<util/delay.h>
#include<compat/deprecated.h>
int main(void)
{DDRC=0xFF;
while(1)
{PORTC=0xFF;
_delay_ms(100);
PORTC=0x00;
_delay_ms(500);
PORTC=0x92;
_delay_ms(1000);
}
}
.......
#include<avr/io.h>
#include<util/delay.h>
#include<compat/deprecated.h>
int main(void)
{DDRC=0xFF;
while(1)
{PORTC=0xFF;
_delay_ms(100);
PORTC=0x00;
_delay_ms(100);
PORTC=0x92;
_delay_ms(100);
PORTC=0x25;
_delay_ms(100);
PORTC=0x48;
_delay_ms(100);
}
}
......
Sa aprind pa rand si apoi sa stang pe rand
#include<avr/io.h>
#include<util/delay.h>
#include<compat/deprecated.h>
int main(void)
{int i;
DDRC=0xFF;
while(1)
{
for(i=0;i<8;i++)
{
sbi(PORTC,i);
_delay_ms(100);
}
for(i=7;i>=0;i--)
{cbi(PORTC,i);
_delay_ms(100);
}
}
}
.....
#include<avr/io.h>
#include<util/delay.h>
#include<compat/deprecated.h>
int main(void)
{int i;
DDRC=0xFF;
PORTC=0x06;
PORTA=0x10;
}
....
Pentru 2
#include<avr/io.h>
#include<util/delay.h>
#include<compat/deprecated.h>
int main(void)
{int i;
DDRC=0xFF;
DDRA=0xF0;
PORTC=0x5B;
PORTA=0x10;
}
....
Cronometru
#include <avr/io.h>
#include <util/delay.h>
#include <compat/deprecated.h>
int main(void)
{int i;
DDRC=0xFF;
DDRA=0xF0;
PORTA=0x10;
while(1)
{
PORTC=0x3F;
_delay_ms(1000);
PORTC=0x06;
_delay_ms(1000);
PORTC=0x5b;
_delay_ms(1000);
PORTC=0x4F;
_delay_ms(1000);
PORTC=0x66;
_delay_ms(1000);
PORTC=0x6D;
_delay_ms(1000);
PORTC=0x7D;
_delay_ms(1000);
PORTC=0x07;
_delay_ms(1000);
PORTC=0x7F;
_delay_ms(1000);
PORTC=0x6F;
_delay_ms(1000);
}
}
....
#include <avr/io.h>
#include <util/delay.h>
#include <compat/deprecated.h>
int main(void)
{char i;
DDRC=0xFF;
DDRA=0xF0;
PORTA=0xF0;
char a[10]={0x3f,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
while(1)
{
for(i=9;i>=0;i--)
{PORTC=a[i];
_delay_ms(500);
}
}
}
......
#include <avr/io.h>
#include <util/delay.h>
#include <compat/deprecated.h>
int main(void)
{char i;
DDRC=0xFF;
DDRA=0xF0;
char a[10]={0x3f,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
while(1)
{
PORTA=0x10;
PORTC=a[1];
_delay_ms(1);
PORTC=0x00;
PORTA=0x20;
PORTC=a[2];
_delay_ms(1);
PORTC=0x00;
}
}
...
Orar semigroup #2
Mecatronica - 25 octombrie
luni, 25 octombrie 2010
by DlMuresan
Categories:
mecatronica
|
Leave a comment