Solved

Events triggered on a counter

Posted on 2008-10-21
3
163 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now