Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

C# synchronized counter time with the system timer

Status
Not open for further replies.

dann11

Full Member level 3
Full Member level 3
Joined
Oct 22, 2015
Messages
166
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
2,742
Hi! I am making a timer that counts by second.

my timer ticks every 100ms.

my simply coded my timer as.

Code:
if (oneSec < 10) oneSec = oneSec + 1;
			else
			{
				oneSec = 0;
				counter++;
			}

with these code, the number increments by 3 secs. can you please help me write the exact equation for it to count exactly per seconds.
 

with these code, the number increments by 3 secs

In preemptive operational systems ( which it is supposed to be your case ) it is not possible to accurately generate tic time at short intervals. The only feasible option is to use the Interrupt (IRQ) feature for this. In the past I have done this by external interruption with a crystal-timed peripheral board, sending serial preamble command at a precisely defined rate, but I believe there is some better tricky way to do that by using internal system resourses available on the mainboard.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top