Zbekiston respublikasi oliy va o‘rta maxsus ta’lim vazirligi farg‘ona davlat universiteti fizika texnika fakulteti


Download 455.21 Kb.
bet4/4
Sana04.01.2023
Hajmi455.21 Kb.
#1077971
1   2   3   4
Bog'liq
Sobirova2013

6-qadam: Step motor

Har xil turdagi step motorlar mavjud , ammo bu qo'llanmada biz bipolyar step motorlar haqida alohida gaplashamiz. Bipolyar step motorlar odatda ikkita bobinga mos keladigan 4 ta pinga ega. Bosqichni ishlatish uchun siz ushbu ikkita sariqni o'zgaruvchan polarit bilan fazada quvvatlantirishingiz kerak.


Qaysi ikkita pin bitta lasanni tashkil qilishini aniqlash uchun uning rozetkasidagi istalgan ikkita pinga LEDni joylashtiring va vosita milini aylantiring. Agar LED yonib tursa, siz bitta lasan topdingiz. Qolgan ikkita pin boshqa lasanni tashkil qilishi kerak.
Bipolyar motorni aylantirish uchun:

  1. Birinchi bobinni quvvatlang.

  2. Keyin ikkinchi lasanni teskari polarit bilan quvvatlang.

  3. Keyin birinchi bobinni teskari polarit bilan quvvatlang.

  4. Nihoyat, ikkinchi lasanni quvvatlang.

Bipolyar stepning motor yo'nalishini o'zgartirish uchun ikkinchi bobinning polaritesini teskari o'zgartirish kifoya.
Stepperni bir yo'nalishda aylantirish uchun kod:

/**************************************************** ****************


Motor Shield Stepper demo
Rendi Sarafan tomonidan
Qo'shimcha ma'lumot olish uchun qarang:

https://www.instructables.com/id/Arduino-Motor-Sh...


***************************************************** ************/

int delaylegnth = 30;

void setup() {
//motor yo'nalishini almashtirish pinlarini o'rnatish
pinMode (12, OUTPUT); //CH A -- HIGHT = oldinga va LOW = orqaga???
pinMode (13, OUTPUT); //CH B -- HIGHT = oldinga va LOW = orqaga???
//motor tormoz pinlarini o'rnatish
pinMode (9, OUTPUT); //tormozlash (o'chirish) CH A
pinMode (8, OUTPUT); //tormozlash (o'chirish) CH B
}
void loop(){
digitalWrite (9, LOW); //CHA NI YOQISH
digitalWrite (8, HIGHT); //CH B NI O'CHIRISh
digitalWrite (12, HIGHT); //CH A yo'nalishini o'rnatadi
analogWrite(3, 255); // CH A ni siljitadi
delay (delaylegnth);
digitalWrite(9, HIGHT); //CHA NI O'CHIRISh
digitalWrite (8, LOW); //CH B NI YOQISH
digitalWrite (13, LOW); //CH B yo'nalishini o'rnatadi
analogWrite(11, 255); // CH B ni siljitadi
delay (delaylegnth);
digitalWrite (9, LOW); //CHA NI YOQISH
digitalWrite (8, HIGHT); //CH B NI O'CHIRISh
digitalWrite (12, LOW); //CH A yo'nalishini o'rnatadi
analogWrite(3, 255); // CH A ni siljitadi
delay (delaylegnth);
digitalWrite(9, HIGHT); //CHA NI O'CHIRISh
digitalWrite (8, LOW); //CH B NI YOQISH
digitalWrite(13, HIGHT); //CH B yo'nalishini o'rnatadi
analogWrite(11, 255); // CH B ni siljitadi
delay (delaylegnth);
}
Mana, qadamni teskari yo'nalishda aylantirish uchun kod:

/**************************************************** ****************


Motor Shield Stepper demo
Rendi Sarafan tomonidan

Qo'shimcha ma'lumot olish uchun qarang:

https://www.instructables.com/id/Arduino-Motor-Sh...

***************************************************** ************/



int delay (delaylegnth);= 30;
void setup() {
//motor yo'nalishini almashtirish pinlarini o'rnatish
pinMode (12, OUTPUT); //CH A -- HIGHT = oldinga va LOW = orqaga???
pinMode (13, OUTPUT); //CH B -- HIGHT = oldinga va LOW = orqaga???
//motor tormoz pinlarini o'rnatish
pinMode (9, OUTPUT); //tormozlash (o'chirish) CH A
pinMode (8, OUTPUT); //tormozlash (o'chirish) CH B
}
void loop(){
digitalWrite (9, LOW); //CHA NI YOQISH
digitalWrite (8, HIGHT); //CH B NI O'CHIRISh
digitalWrite (12, HIGHT); //CH A yo'nalishini o'rnatadi
analogWrite(3, 255); // CH A ni siljitadi
delay (delaylegnth);
digitalWrite(9, HIGHT); //CHA NI O'CHIRISh
digitalWrite (8, LOW); //CH B NI YOQISH
digitalWrite(13, HIGHT); //CH B yo'nalishini o'rnatadi
analogWrite(11, 255); // CH B ni siljitadi
delay (delaylegnth); digitalWrite (9, LOW); //CHA NI YOQISH
digitalWrite (8, HIGHT); //CH B NI O'CHIRISh
digitalWrite (12, LOW); //CH A yo'nalishini o'rnatadi
analogWrite(3, 255); // CH A ni siljitadi
delay (delaylegnth);
digitalWrite(9, HIGHT); //CHA NI O'CHIRISh
digitalWrite (8, LOW); //CH B NI YOQISH
digitalWrite (13, LOW); //CH B yo'nalishini o'rnatadi
analogWrite(11, 255); // CH B ni siljitadi
delay (delaylegnth);
}
Download 455.21 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling