This is not the document you are looking for? Use the search form below to find more!

Report home > Others

An Easy Timer In C Language

0.00 (0 votes)
Document Description
An Easy Timer In C Language
File Details
Submitter
  • Name: alfredina
Embed Code:

Add New Comment




Related Documents

How To Define An Integer Constant In C

by: titina, 5 pages

How to define an integer constant in C? This is a tricky issue with a number of options available in C. They include: 3. Explicit use of literal 4. Use…

C Language Lab Manual

by: myricoorish, 3 pages

C- LANGUAGE LAB MANUAL C- LANGUAGE LAB MANUAL for B.Tech, B.E and More http://studentyogi.com/?attachment_id=747 September 5th, 2009 · Lab Manuals · No comments · Read More » • ...

Summer Training in C++

by: duccsystems, 7 pages

DUCC Systems invites all to C++ training in June and july.

UPTU MCA 1SEM CONCEPT PROGRAMMIN IN C 2010-2011

by: ASHISH, 4 pages

OLD PAPER 2010-2011

Dynamic Binding in C# 4.0

by: alina, 44 pages

Dynamic Binding in C# 4.0

Real World (adapted texts in Russian language for beginners)

by: bestrel, 7 pages

adapted texts in Russian language for beginners

Dialect and Standard in Second Language Phonology: The Case of ...

by: imogen, 25 pages

This paper shows that students who learn Standard Arabic before a dialect take 'an etymological trip' in learning the phonology of the dialect in question. The paper also discusses instructional ...

Literature development in minority language: Case study of Gutob ...

by: tetsuo, 7 pages

Gutob-Gadaba is one such dying language in Southern Orissa. Approximately eighty percent of the original speakers have shifted to Deisya, the lingua franca of Koraput district. This paper focuses on ...

Tutorial on C Language Programming

by: desantis, 64 pages

Tutorial on C Language Program Teodor Rus The University of Iowa, Department of Computer Science

Functional Programming in C++

by: dutcher, 12 pages

This paper describes FC++: a rich library supporting functional programming in C++. Prior approaches to encoding higher order functions in C++ have suffered with respect to polymorphic functions from ...

Content Preview
An easy timer in C languagehttp://dev.emcelettronica.com/print/51711 Your Electronics Open Source(http://dev.emcelettronica.com)Home > Blog > arag61's blog > ContentAn easy timer in C languageBy arag61Created 15/03/2008 - 10:48BLOGA good exercise for a beginner is to implement a module that pretends a timer.To do this we have used the following functions that already exist in C library:delay() – suspends execution for interval [ milliseconds ] ( defined in DOS.H )kbhit() – checks for currently available keystrokes ( defined in CONIO.H )printf() - outputs a formattes message to video. (STDIO.H)clrscr() – clears text mode window ( defined in CONIO.H )Below there is the module code :#include <stdio.h>#include <dos.h>#include <conio.h>void timer(float cycle){float count=0.0;int goLoop=1; while(goLoop) { if(kbhit()) { // Keypressed, exit goLoop=0; }else{ delay(100); count+=0.1; if(count> cycle) { // Time expired, exit goLoop=0; } } clrscr(); printf(“ The timer is %06.1f seconds\n”, cycle); } // end for} // end moduleAs we can see there is one “while” loop using the (blocking) library function delay(), (e.g. delay(1000) = 1second ;delay(10) = 0,01 second), we here use a 1 tenth of second delay (delay(100)).For each loop the variable count is increment by 1 tenth then an end of interval control is done (if(count> cycle)).We used as well function kbhit() to stop the timer on demand ( with just a keypress).Variable “cycle” is obviously a float type to get a 1 tenth of second resolution.Morover timer value is output to video using printf with a format specifier %06,1f (e.g. 0014.5).To use this timer every time we want, we have to :Create an header file where the TIMER prototype must be declared.Include this header file in the main program.In the main program code we must call this module using the same type variable ( float in this case ).Compile this module and see if any errors occur.A possible header file code could be :#ifndef __TIMER_H__#define __TIMER_H__1 di 223/04/2008 12.13An easy timer in C languagehttp://dev.emcelettronica.com/print/51711void timer(float cycle);#endifIn the main program #include “timer.h” must be included among the other header files and the module could be calledwith the following instruction : timer (x); where x has been declared as float type.Trademarks Source URL: http://dev.emcelettronica.com/easy-timer-c-language2 di 223/04/2008 12.13

Download
An Easy Timer In C Language

 

 

Your download will begin in a moment.
If it doesn't, click here to try again.

Share An Easy Timer In C Language to:

Insert your wordpress URL:

example:

http://myblog.wordpress.com/
or
http://myblog.com/

Share An Easy Timer In C Language as:

From:

To:

Share An Easy Timer In C Language.

Enter two words as shown below. If you cannot read the words, click the refresh icon.

loading

Share An Easy Timer In C Language as:

Copy html code above and paste to your web page.

loading