Cov txheej txheem:

DS1307 Moos Nrog CloudX: 4 Kauj Ruam
DS1307 Moos Nrog CloudX: 4 Kauj Ruam

Video: DS1307 Moos Nrog CloudX: 4 Kauj Ruam

Video: DS1307 Moos Nrog CloudX: 4 Kauj Ruam
Video: PIC18F4550 RELOJ CALENDARIO DE TIEMPO REAL RTC DS1307 MPLAB X XC8 2024, Kaum ib hlis
Anonim
DS1307 Moos Nrog CloudX
DS1307 Moos Nrog CloudX
DS1307 Moos Nrog CloudX
DS1307 Moos Nrog CloudX

Puas tau xav txog koj xav ua koj tus kheej kev saib lossis moos. koom ua ke DS1307 thiab CloudX tuaj yeem ua rau koj qhov kev cia siab tsis muaj teeb meem

Kauj Ruam 1: Qhib Koj CloudX IDE

Qhib Koj CloudX IDE
Qhib Koj CloudX IDE
Qhib Koj CloudX IDE
Qhib Koj CloudX IDE

Thov txim uas tsis yog tus tham ntau, tab sis kuv paub thaum nws los txog rau Lub Sijhawm Sijhawm Tseeb, cloudX tau txais koj npog.

Cov kauj ruam yooj yim

1. ntshuam cloudX lub tsev qiv ntawv tseem ceeb nrog txo nws cov qauv qauv

2. ntshuam DS1307 thiab lwm lub tsev qiv ntawv ua haujlwm xav tau

3. txaus siab thiab ua si nrog DS1307 kev ua haujlwm los ntawm nws lub tsev qiv ntawv

Kauj ruam 2: CODE!, CODE !!, CODE !

/*

* Cov ntaub ntawv: main.c * Sau: Ogboye Godwin * * Tsim rau lub Plaub Hlis 24, 2018, 11:02 AM */

#suav nrog

#suav nrog

#suav nrog

tsis tau kos npe sijhawm luv [9], Hnub tim [11];

unsigned luv mth, Hnub, yr, hr, min, sec;

getDateTime ();

loadLcd ();

resetClock ();

int cov = 16;

int cov = 15;

int dec = 14;

teeb tsa () {

pinMode (teeb, INPUT);

pinMode (inc, INPUT);

pinMode (dec, INPUT);

pinMode (1, INPUT);

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

Ds1307_init ();

rov () {

thaum (readPin (teeb) == 0) {

getDateTime ();

loadLcd ();

qeeb (500);

}

yog (readPin (teeb) == 1)

resetClock ();

}

}

getDateTime () {

hr = Ds1307_read (teev); // hli

sijhawm [0] = BCD2UpperCh (hr);

sijhawm [1] = BCD2LowerCh (hr);

sij hawm [2] = ':';

min = Ds1307_read (feeb); // kuv

sijhawm [3] = BCD2UpperCh (min);

sij hawm [4] = BCD2LowerCh (min);

sij hawm [5] = ':';

sec = Ds1307_read (thib ob); // nqi

sij hawm [6] = BCD2UpperCh (sec);

sij hawm [7] = BCD2LowerCh (sec);

mth = Ds1307_read (hli); // hli

Mdate [0] = BCD2UpperCh (mth);

Hnub tim [1] = BCD2LowerCh (mth);

Hnub [2] = ':';

Hnub = Ds1307_read (hnub tim); // hnub

Hnub tim [3] = BCD2UpperCh (Hnub);

Hnub tim [4] = BCD2LowerCh (Hnub);

Hnub [5] = ':';

yr = Ds1307_read (xyoo); // xyoo

Hnub [6] = '2';

Hnub [7] = '0';

Hnub tim [8] = BCD2UpperCh (yr);

Hnub tim [9] = BCD2LowerCh (yr);

}

loadLcd () {

koj cx;.

Lcd_cmd (meej);

Lcd_writeText (1, 1, "Hnub tim:");

// lcdWriteTextCP (Hnub tim);

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

Lcd_writeCP (Hnub tim [cx]);

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

// lcdWriteTextCP (sijhawm);

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

Lcd_writeCP (sijhawm [cx]);

}

resetClock () {

Ds1307_write (thib ob, Binary2BCD (0)); // sau 0 thib ob

Ds1307_write (feeb, Binary2BCD (12)); // sau 12 feeb

Ds1307_write (teev, Binary2BCD (12)); // sau 12hrs

Ds1307_write (hnub, Binary2BCD (3)); // sau hnub tuesday

Ds1307_write (hnub tim, Binary2BCD (24)); // sau hnub tim 24

Ds1307_write (hli, Binary2BCD (4)); // sau lub hli rau lub Plaub Hlis

Ds1307_write (xyoo, Binary2BCD (18)); // sau xyoo 18 i.e 2018

Ds1307_write (SQWE, Binary2BCD (zaus)); // teeb tsa SQWE tso zis rau 1hz

Ds1307_write (thib ob, Binary2BCD (startOscilator)); // rov pib dua thib ob rau 0sec thiab pib oscilator

thaum (readPin (teeb) == 1);

}

Kauj Ruam 3: Tsim hauv Proteus

Tsim hauv Proteus
Tsim hauv Proteus

hom hauv proteus yog cov kev xav tau no

1. cloudX

2. DS1307

3. 4.7k resistor

4. khawm

5. lm016 LCD

6. Crystal ntawm 32khz

thiab lossis tsis txhob hnov qab koj qhov zoo thiab hauv av.

ua koj cov kev sib txuas zoo li kuv.

Pom zoo: