|
O‘rnatilgan tizimlari fanidan 3-topshiriq mavzu: Bir razryadli va to’rt razryadli yetti segmetli indikator(display) Bajardi
|
Sana | 14.05.2024 | Hajmi | 362,75 Kb. | | #232139 |
Bog'liq 3-topshiriq
O‘ZBEKISTON RESPUBLIKASI
RAQAMLI TEXNOLOGIYALAR VAZIRLIGI
MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI
O‘rnatilgan tizimlari fanidan
3-TOPSHIRIQ
Mavzu: Bir razryadli va to’rt razryadli yetti segmetli indikator(display)
Bajardi: 214-21 guruh talabasi
Abdibayev Nursultan
Tekshirdi: Xoldorov Sh.I.
TOSHKENT – 2024
3-topshiriq
Amaliy qism: Men bu topshiriqni bajarish davomida wokwi.com sayti orqali potensiometr, tort razryadli yetti segmentli indikator va ledlar yordamida indikatorda qaysi son chiqsa, o’sha sonni ikkilikka o’tkazib o’sha ikkilik son bo’yicha ledlarni yoqish dasturini ishlab chiqdim.
1-rasm: Amaliy qism ulanish sxemalari ko’rinishi.
2-rasm: Amaliy qism ulanish sxemalari va kodining to’liq ko’rinishi.
Kod qismi:
const int a=2;
const int b=3;
const int c=4;
const int d=5;
const int e=6;
const int f=7;
const int g=8;
const int dp=9;
const int d1=10;
const int d2=11;
const int d3=12;
const int d4=13;
const int l[]={
A0, A1, A2, A3, A4, A5
};
void setup() {
Serial.begin(9600);
for(int i=2;i<=13;i++){
pinMode(i,OUTPUT);
}
for(int i=0;i<=5;i++){
pinMode(l[i],OUTPUT);
}
}
void lamp(int a){
int k=0;
while(a!=0){
digitalWrite(l[5-k],a%2);
a=a/2;
k++;
}
}
int time=0;
int san=1;
void loop() {
if(time == 50){
time=0;
san=random(10000);
}
time++;
delay(50);
son(san);
lamp(san);
}
void son(int num){
int minglik = num/1000;
int yuzlik = (num/100)%10;
int unlik = (num%100)/10;
int birlik = num%10;
tozala();
digitalWrite(d1,1);
digitalWrite(d2,0);
digitalWrite(d3,0);
digitalWrite(d4,0);
raqam(minglik);
tozala();
digitalWrite(d1,0);
digitalWrite(d2,1);
digitalWrite(d3,0);
digitalWrite(d4,0);
raqam(yuzlik);
tozala();
digitalWrite(d1,0);
digitalWrite(d2,0);
digitalWrite(d3,1);
digitalWrite(d4,0);
raqam(unlik);
tozala();
digitalWrite(d1,0);
digitalWrite(d2,0);
digitalWrite(d3,0);
digitalWrite(d4,1);
raqam(birlik);
}
void raqam(int num){
switch (num){
case 0: nol();break;
case 1: bir();break;
case 2: ikki();break;
case 3: uch();break;
case 4: turt();break;
case 5: besh();break;
case 6: olti();break;
case 7: yetti();break;
case 8: sakkiz();break;
case 9: toqqiz();break;
default: tozala();break;
}
}
void tozala(){
digitalWrite(a,1);
digitalWrite(b,1);
digitalWrite(c,1);
digitalWrite(d,1);
digitalWrite(e,1);
digitalWrite(f,1);
digitalWrite(g,1);
digitalWrite(dp,0);
}
void nol(){
digitalWrite(a,0);
digitalWrite(b,0);
digitalWrite(c,0);
digitalWrite(d,0);
digitalWrite(e,0);
digitalWrite(f,0);
digitalWrite(g,1);
digitalWrite(dp,1);
}
void bir(){
digitalWrite(a,1);
digitalWrite(b,0);
digitalWrite(c,0);
digitalWrite(d,1);
digitalWrite(e,1);
digitalWrite(f,1);
digitalWrite(g,1);
digitalWrite(dp,1);
}
void ikki(){
digitalWrite(a,0);
digitalWrite(b,0);
digitalWrite(c,1);
digitalWrite(d,0);
digitalWrite(e,0);
digitalWrite(f,1);
digitalWrite(g,0);
digitalWrite(dp,0);
}
void uch(){
digitalWrite(a,0);
digitalWrite(b,0);
digitalWrite(c,0);
digitalWrite(d,0);
digitalWrite(e,1);
digitalWrite(f,1);
digitalWrite(g,0);
digitalWrite(dp,1);
}
void turt(){
digitalWrite(a,1);
digitalWrite(b,0);
digitalWrite(c,0);
digitalWrite(d,1);
digitalWrite(e,1);
digitalWrite(f,0);
digitalWrite(g,0);
digitalWrite(dp,1);
}
void besh(){
digitalWrite(a,0);
digitalWrite(b,1);
digitalWrite(c,0);
digitalWrite(d,0);
digitalWrite(e,1);
digitalWrite(f,0);
digitalWrite(g,0);
digitalWrite(dp,1);
}
void olti(){
digitalWrite(a,0);
digitalWrite(b,1);
digitalWrite(c,0);
digitalWrite(d,0);
digitalWrite(e,0);
digitalWrite(f,0);
digitalWrite(g,0);
digitalWrite(dp,1);
}
void yetti(){
digitalWrite(a,0);
digitalWrite(b,0);
digitalWrite(c,0);
digitalWrite(d,1);
digitalWrite(e,1);
digitalWrite(f,1);
digitalWrite(g,1);
digitalWrite(dp,1);
}
void sakkiz(){
digitalWrite(a,0);
digitalWrite(b,0);
digitalWrite(c,0);
digitalWrite(d,0);
digitalWrite(e,0);
digitalWrite(f,0);
digitalWrite(g,0);
digitalWrite(dp,1);
}
void toqqiz(){
digitalWrite(a,0);
digitalWrite(b,0);
digitalWrite(c,0);
digitalWrite(d,0);
digitalWrite(e,1);
digitalWrite(f,0);
digitalWrite(g,0);
digitalWrite(dp,1);
}
Link: https://wokwi.com/projects/396663909487264769
Xulosa:
Xulosa qilib aytadigan bolsam men ushbu topshiriqni bajarish davomida wokwi.com saytidan foydalangan xolda tort razryadli yetti segmentli indikator va ledlardan foydalanib indekator qanday qiymat bersa osha qiymatni ikkilikka otkazib osha qiymatni ledlarda korsatishni qilib chiqdim.
|
|
Bosh sahifa
Aloqalar
Bosh sahifa
O‘rnatilgan tizimlari fanidan 3-topshiriq mavzu: Bir razryadli va to’rt razryadli yetti segmetli indikator(display) Bajardi
|