- Kayıt
- 18 Şubat 2015
- Mesajlar
- 141
- Tepkiler
- 87
- Meslek
- Öğrenci
Merhaba arkadaşlar 3.dersimizi de çekmiş bulunmaktayım. Umarım faydalı olmuştur. Sorularını sorabilirsiniz. bu başlık altında. Ayrıca destek amaçlı kanalıma abone olursanız çok sevirim beni kamçılıyor diyebilirim.
kodumuz :
/*
* avrc2.c
*
* Created: 16.08.2015 13:38:05
* Author: volkan ünal
*/
#define F_CPU 200000000L
#include <avr/io.h>
#include <util/delay.h>
#define data_port PORTB
#define data_pin 0
#define storage_port PORTB
#define storage_pin 1
#define shift_port PORTB
#define shift_pin 2
#define data_low() data_port &=~_BV(data_pin)
#define data_high() data_port |=_BV(data_pin)
#define storage_low() storage_port &= ~_BV(storage_pin)
#define storage_high() storage_port |=_BV(storage_pin)
#define shift_low() shift_port &= ~_BV(shift_pin)
#define shift_high() shift_port|=_BV(shift_pin)
void cikis(char _cikis) {
storage_low();
shift_low();
for(uint8_t i=0; i<8; i++) {
if(bit_is_set(_cikis , i))
{data_high(); }
else {
data_low(); }
shift_high();
shift_low();
}
storage_high();
}
int main(void)
{ DDRB=0x07
PORTB=0;
while(1)
{
for(uint8_t i=8; i>0; i--){
cikis(_BV(i));
_delay_ms(10);
}
for(uint8_t i=0; i<8; i++)
{
cikis(_BV(i));
_delay_ms(10);
}
}
}
kodumuz :
/*
* avrc2.c
*
* Created: 16.08.2015 13:38:05
* Author: volkan ünal
*/
#define F_CPU 200000000L
#include <avr/io.h>
#include <util/delay.h>
#define data_port PORTB
#define data_pin 0
#define storage_port PORTB
#define storage_pin 1
#define shift_port PORTB
#define shift_pin 2
#define data_low() data_port &=~_BV(data_pin)
#define data_high() data_port |=_BV(data_pin)
#define storage_low() storage_port &= ~_BV(storage_pin)
#define storage_high() storage_port |=_BV(storage_pin)
#define shift_low() shift_port &= ~_BV(shift_pin)
#define shift_high() shift_port|=_BV(shift_pin)
void cikis(char _cikis) {
storage_low();
shift_low();
for(uint8_t i=0; i<8; i++) {
if(bit_is_set(_cikis , i))
{data_high(); }
else {
data_low(); }
shift_high();
shift_low();
}
storage_high();
}
int main(void)
{ DDRB=0x07
PORTB=0;
while(1)
{
for(uint8_t i=8; i>0; i--){
cikis(_BV(i));
_delay_ms(10);
}
for(uint8_t i=0; i<8; i++)
{
cikis(_BV(i));
_delay_ms(10);
}
}
}