mavzu: 74HC595 suruvchi registr mikrosxemasi razryadli matrisani boshqarish. Ishdan maqsad
tarix 11.05.2023 ölçüsü 0,52 Mb. #111044
mavzu 74HC595 suruvchi registr mikrosxemasi razryadli matrisani
8-mavzu: 74HC595 suruvchi registr mikrosxemasi. 4 razryadli matrisani boshqarish.
Ishdan maqsad: 74HC595 suruvchi registr mikrosxemasini o’rganish va ardunio muhutida dasturini tuzush.
1-rasm. Arduino muhutida dastur yozilgan holat
2-rasm. Proteus muhutida yig’ilgan holati.
Proteusda sxemani yig’ish uchun bizga quyudagi elementlar kerak bo’ladi:
Arduino uno
74HC595 registr
Power
Graund
Res
Led
Darstur kodi
int dataPin = 7;
int latchPin = 8;
int clockPin = 13;
int dataPin2=A3;
int latchPin2= A4;
int clockPin2=A5;
byte leds = 0;
void setup() {
pinMode (dataPin, OUTPUT);
pinMode (latchPin, OUTPUT);
pinMode (clockPin, OUTPUT);
pinMode (dataPin2, OUTPUT);
pinMode (latchPin2, OUTPUT);
pinMode (clockPin2, OUTPUT);
}
void loop() {
leds = 0;
updateShiftRegister ();
delay (200);
for (int i = 0; i<8; i++)
{
bitSet (leds, i);
updateShiftRegister ();
delay (200);
}
leds = 0;
updateShiftRegister ();
delay (200);
for (int i = 8; i>=0; i--)
{
bitSet (leds, i);
updateShiftRegister ();
delay (200);
}
}
void updateShiftRegister ()
{
digitalWrite (latchPin,LOW);
shiftOut (dataPin, clockPin, MSBFIRST, leds);
digitalWrite (latchPin, HIGH);
digitalWrite (latchPin2,LOW);
shiftOut (dataPin2, clockPin2, MSBFIRST, leds);
digitalWrite (latchPin2, HIGH);
}
Dastur kodi ishga tushirilganda. Dostları ilə paylaş: