is there an if/else function that implements IMMEDIATELY?

This is a discussion on is there an if/else function that implements IMMEDIATELY? within the C Programming forums, part of the General Programming Boards category; If your MCU supports interrupts; I would place the call to the function in the interrupt service routine. Tim S....

  1. #16
    Registered User
    Join Date
    May 2009
    Posts
    2,506
    If your MCU supports interrupts; I would place the call to the function in the interrupt service routine.

    Tim S.

  2. #17
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by 777funk View Post
    Did this now and it will not start until it gets the HIGH signal but still runs through the entire while loop before stopping. I am really stuck on how to get it to exit the while loop with a realtime reading of the pin as it goes LOW.
    It only enters the loop while the condition is true. If it's not true when it reaches the loop the first time, it's going to skip it completely. If you need it to execute at least once, use a do-while. Or, put what always has to happen first outside the loop, and then if it needs to be inside too, put it there too.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #18
    Registered User
    Join Date
    Nov 2010
    Posts
    24
    Well I actually don't necessarily want it to execute all the way through any of the sub loops (and their are lots of them within the main while loop which is triggered by the HIGH pin) in my program even once. I just want it to operate like a switch... as soon as I tell it to stop, I want it to stop and exit the loop in the program.

    So far GOTO, Break, and everything else suggested works but it doesn't immediately get out. It finishes the sub loop it's currently in and THEN exits. That's not quite what I'm looking for.

    I want the program to drop what it's doing and exit the main while loop that houses the other loops within the program.

    Any pointers on that?
    Last edited by 777funk; 11-24-2010 at 07:00 PM.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling C in Visual Studio 2005
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-16-2009, 03:25 AM
  2. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  3. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  4. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 01:28 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 09:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21