THE SIMPLEST ALGORITHM TIMER ARDUINO

The simplest algorithm timer Arduino - In mikroprosessor's programs,  mark sense Timer's component becomes momentous to back up device's makings process that utilize timer's function as logger's data, counter, countdown, delay and any other as it. But available timer condition on mikroprosessor as syntax “ millis ”, “counter ”, “countdown ” and another syntax is perceived still reducing is equal to for lack of system reset automatically, so required by tech to engineer system with memamfaatkan device affix one of it is RTC (Real time Clock). timer's algorithm on this mikroprosessor's mathematics using RTC'S function to engineer timer as logistic as counter, delay etc. which have reset's function automatically so gets to optimize device's purpose that require timer's function.
THE SIMPLEST ALGORITHM TIMER ARDUINO
Figure 1.1 RTC DS1307

About problem
Don't mark sense reset's system and counter / delay's duration that relative abbreviates on timer's function mikroprosessor's programs causes less effective timer's logistic purpose in mikrokontroller's peripheral. So needed by problem formulation how engineer timer's Algorithm as counter / delay who proveded with by system reset automatic and on the defensive in long time duration.


Tech and Algorithm
In this Timer's Algorithm, utilized by RTC'S component (Real Time Clock) which is a Chip (IC) one that functioning as depositor of time and date of. RTC'S type that is utilized is DS 1307. Where is this RTC'S type can keep data as sec as, minute, the time of day, date of, days, valid's moon and year until 2100. 56 byte.


Hereafter RTC this diintergrasikan with Meikroprosessor Arduino with wiring from VCC goes to 5V, GND goes to GND, Idem to pin 4, SCL goes to pin 5. as one appear on image this following:

THE SIMPLEST ALGORITHM TIMER ARDUINO
THE SIMPLEST ALGORITHM TIMER ARDUINO

Source code:

#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <Wire.h>
#include <DS1307.h>
// Library Arduino

int detik,detik1;
int a=0;
int timer=0;

void setup()
{
  Serial.begin(9600);
}

void loop() {
  detik=(RTC.get(DS1307_SEC,true));

  if (a==0){
    detik1=detik;
    a=1;}

  if (detik1=!detik){
    timer=timer+1;
    a=0;

  Serial.println(timer);
}
}


Application potency
timer's algorithm functions in addition on peripheral that need condition regulator to become more optimal since by use of algorithm timer this, we can control working hour a system base particular conditions, e.g. if you want a system / equipment be conected with afters condition 10 second accept to detect from censors, therefore timer this wills be logistic as counter its time in delay on system / that equipment.




Related Posts:

0 Response to "THE SIMPLEST ALGORITHM TIMER ARDUINO"

Post a Comment

>