Thread: Event driven conditional??

  1. #1
    Registered User
    Join Date
    Oct 2006

    Event driven conditional??

    I am programming a PIC to send bytes using a baud rate specified by a Timer2 interrupt (needless info)

    anyway. Is there a conditional statement that will halt execution UNTIL the condition is true. Im using timed interrupts to change the condition and when the condition evaluates to true I would like the program execution to continue, but if the condition is not true yet I dont want it to skip over the conditional. Any suggestion would be helpful...

  2. #2
    Registered User SKeane's Avatar
    Join Date
    Sep 2006
    Single or multi-threaded?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    You mean like an if() or a while()

    Or seeing as this is an embedded programming exercise, maybe your chosen CPU has a "halt" instruction which suspends everything until the next interrupt.

    Do you have an OS on this PIC, or are you down on the bare metal?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Oct 2006
    yeah like an if () or a while ()

    there is no operating system

    the condition may not always be true, but it will become true once the interrupt gets around to the right condition

    single threaded for all i know

    while (i==3) do this ;
    at the same time the interrupt is cycling i from 0-7 over and over again;

    will while (i==3) wait till i = 3 to continue execution?? or will it just skip it if it is not 3 at that moment??

    tell me if i need to clarify more, this may not be crystal

  5. #5
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    United States
    If i != 3, the loop will break. This may be okay or not depending on how you control i.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to organize an event driven system
    By Marksman in forum C++ Programming
    Replies: 2
    Last Post: 02-04-2008, 06:11 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Event driven thread programming
    By jaxen in forum C++ Programming
    Replies: 6
    Last Post: 11-22-2006, 08:46 AM
  4. Event Driven coding to C
    By n3on in forum C Programming
    Replies: 2
    Last Post: 08-11-2005, 02:34 PM