Mundarija:

CloudX bilan DS1307 soati: 4 qadam
CloudX bilan DS1307 soati: 4 qadam

Video: CloudX bilan DS1307 soati: 4 qadam

Video: CloudX bilan DS1307 soati: 4 qadam
Video: Ремонт на балконе Ошибки монтажа теплого пола. #37 2024, Noyabr
Anonim
CloudX bilan DS1307 soati
CloudX bilan DS1307 soati
CloudX bilan DS1307 soati
CloudX bilan DS1307 soati

Siz o'zingiz xohlagan soat yoki soat yasashni xohlayotganingizni tasavvur qiling. DS1307 va CloudXni birlashtirish sizning intilishingizni muammosiz hal qilishi mumkin

1 -qadam: CloudX IDE -ni oching

CloudX IDE -ni oching
CloudX IDE -ni oching
CloudX IDE -ni oching
CloudX IDE -ni oching

Kechirasiz, men unchalik gapirmaydigan odamman, lekin bilaman, Real Time Clock loyihalari haqida gap ketganda, cloudX sizni qamrab olgan.

Oddiy qadamlar

1. importli bulutX asosiy kutubxonasini taxta modelini slash bilan

2. DS1307 va boshqa funktsional kutubxonani import qilish

3. kutubxonasidagi DS1307 funktsiyalari bilan zavqlaning va o'ynang

2 -qadam: KOD!, KOD !!, KOD !!

/*

* Fayl: main.c * Muallif: Ogboye Godwin * * 2018 yil 24 -aprel, soat 11:02 da yaratilgan */

#qo'shing

#qo'shing

#qo'shing

imzosiz qisqa vaqt [9], Mdate [11];

imzosiz qisqa mth, Dday, yr, hr, min, sek;

getDateTime ();

loadLcd ();

resetClock ();

int set = 16;

int inc = 15;

int dec = 14;

sozlash(){

pinMode (o'rnatish, Kirish);

pinMode (shu jumladan, INPUT);

pinMode (dek, INPUT);

pinMod (1, Kirish);

Lcd_setting (2, 3, 4, 5, 6, 7);

Ds1307_init ();

pastadir () {

while (readPin (set) == 0) {

getDateTime ();

loadLcd ();

kechikishlar (500);

}

agar (readPin (to'siq) == 1)

resetClock ();

}

}

getDateTime () {

soat = Ds1307_ o'qish (soat); // soat

vaqt [0] = BCD2UpperCh (soat);

vaqt [1] = BCD2LowerCh (soat);

vaqt [2] = ':';

min = Ds1307_ o'qish (daqiqa); // min

vaqt [3] = BCD2UpperCh (min);

vaqt [4] = BCD2LowerCh (min);

vaqt [5] = ':';

sek = Ds1307_read (ikkinchi); // sek

vaqt [6] = BCD2UpperCh (sek);

vaqt [7] = BCD2LowerCh (sek);

mth = Ds1307_read (oy); // oy

Mdate [0] = BCD2UpperCh (mth);

Mdate [1] = BCD2LowerCh (mth);

Mdate [2] = ':';

Dday = Ds1307_read (sana); // kun

Mdate [3] = BCD2UpperCh (Dday);

Mdate [4] = BCD2LowerCh (Dday);

Mdate [5] = ':';

yr = Ds1307_ o'qish (yil); // yil

Mdate [6] = '2';

Mdate [7] = '0';

Mdate [8] = BCD2UpperCh (yil);

Mdate [9] = BCD2LowerCh (yil);

}

loadLcd () {

int cx;

Lcd_cmd (aniq);

Lcd_writeText (1, 1, "Sana:");

// lcdWriteTextCP (Mdate);

uchun (cx = 0; cx <11; cx ++)

Lcd_writeCP (Mdate [cx]);

Lcd_writeText (2, 1, "Vaqt:");

// lcdWriteTextCP (vaqt);

uchun (cx = 0; cx <9; cx ++)

Lcd_writeCP (vaqt [cx]);

}

resetClock () {

Ds1307_write (ikkinchi, Binary2BCD (0)); // 0 soniya yozing

Ds1307_write (daqiqa, Binary2BCD (12)); // yozish 12 daqiqa

Ds1307_write (soat, Binary2BCD (12)); // 12 soat yozing

Ds1307_write (kun, Binary2BCD (3)); // seshanba kuni yozing

Ds1307_write (sana, Binary2BCD (24)); // yozilish sanasi 24

Ds1307_write (oy, Binary2BCD (4)); // aprel oyini yozing

Ds1307_write (yil, Binary2BCD (18)); // 18 -yil yozing, ya'ni 2018

Ds1307_write (SQWE, Binary2BCD (chastota)); // SQWE chiqishini 1 Gts ga sozlang

Ds1307_write (ikkinchi, Binary2BCD (startOscilator)); // soniyani 0 soniyaga qaytaring va osilatorni ishga tushiring

while (readPin (set) == 1);

}

3 -qadam: Proteusda dizayn

Proteusda dizayn
Proteusda dizayn

Ushbu talablar proteus isining turiga kiradi

1. bulutX

2. DS1307

3. 4,7 k qarshilik

4. tugma

5. LCD lm016

6. 32 kHz chastotali kristalli

va, albatta, sizning ijobiy va asosingizni unutmang.

aloqalaringizni meniki kabi qiling.

Tavsiya: