Timer Control
Uncategorized November 11th. 2009, 9:17amTimer Control

Electronic Timers
A timer is a specialized type of clock. A timer can be used to control the sequence of an event or process. Whereas a stopwatch counts upwards from zero for measuring elapsed time, a timer counts down from a specified time interval, like an hourglass. Timers can be mechanical, electromechanical, electronic (quartz), or even software as all modern computers include digital timers of one kind or another. When the set period expires some timers simply indicate so (e.g., by an audible signal), while others operate electrical switches.
Electronic timers are essentially quartz clocks with special electronics, and can achieve higher precision than mechanical timers. Electronic timers have digital electronics, but may have an analogue or digital display. Integrated circuits have made digital logic so inexpensive that an electronic timer is now less expensive than many mechanical and electromechanical timers. Individual timers are implemented as a simple single-chip computer system, similar to a watch and usually using the same, mass-produced, technology.
Many timers are now implemented in software. Modern controllers use a programmable logic controller rather than a box full of electromechanical parts. The logic is usually designed as if it were relays, using a special computer language called ladder logic. In PLCs, the software built into the controller usually simulates timers. Each timer is just an entry in a table maintained by the software.
Digital timers are used in safety device such as a gas timer.
Computer systems usually have at least one timer. These are typically digital counters that either increment or decrement at a fixed frequency, which is often configurable, and that interrupt the processor when reaching zero, or a counter with a sufficiently large word size that it will not reach its counter limit before the end of life of the system.
More sophisticated timers may have comparison logic to compare the timer value against a specific value, set by software, that triggers some action when the timer value matches the preset value. This might be used, for example, to measure events or generate pulse width modulated waveforms to control the speed of motors (using a class D digital electronic amplifier).
About the Author
The author is associated with IPFonline
http://www.ipfonline.com is India's No. 1 Industrial Product Finder. The portal is a veritable storehouse of information on industrial products/services.
How to create a timer in Visual Basic 6?
I know how to create a timer using the timer control, but don't know how to get it into the proper format. So what I'm saying is that I don't want the time displayed to be 126 seconds, but 2 minutes and 6 seconds. Any (easy) way to do this? Any help appreciated.
i converted this from my C# code. Since i dont have visual basic 6 anymore, i just whiped this up from memory. Sorry if it doesnt compile directly. Use the visual basic 6 mod function to get the remander of seconds from seconds / 60
example:
iSecondsRemaining = iSeconds mod 60
Function ConvertTime(iSec as Integer) as String
'convert the time to 00:00 format
iMinutes as integer = 0
iSeconds as integer = iSec
sSeconds as string
'calculate
iSeconds = iSec mod 60 '(use the mod function)
iMinutes = iSec /60
'format
sSeconds = str$(iSeconds)
if (len(sSeconds) = 1) then sSeconds = "0" & sSeconds
Function = Str$(iMinutes) & ":" & sSeconds
end function
7. Simple Animations with timer control - Tutorial VB 2008




