Solved

Events triggered on a counter

Posted on 2008-10-21
3
168 Views
Last Modified: 2012-05-05
I have a small ISR with an if statement.  I have a 360 slot trigger wheel and what im trying to do is create an if statement that will only equate true on every 8th tooth.  The idea is to make it into a 45 tooth wheel, buy only executing on every 8th.  My problem is that I'm not sure how the statement should look.

something like this maybe..........
 
if(counter % 8)
{
do some stuff
}

Open in new window

0
Comment
Question by:SeanKeys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 500 total points
ID: 22768982
Hello SeanKeys,

if ( counter % 8 == 0 )
{
   //do stuff
}

Regards,

sunnycoder
0
 

Author Comment

by:SeanKeys
ID: 22769290
couldn't I also do

if (!(counter % 8))



?
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 22769299
Yes ... that would work too
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question