Event driven conditional??

This is a discussion on Event driven conditional?? within the C Programming forums, part of the General Programming Boards category; I am programming a PIC to send bytes using a baud rate specified by a Timer2 interrupt (needless info) anyway. ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    5

    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
    Location
    England
    Posts
    234
    Single or multi-threaded?

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,673
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    5
    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

    Example:
    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
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,741
    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, 05: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, 07:46 AM
  4. Event Driven coding to C
    By n3on in forum C Programming
    Replies: 2
    Last Post: 08-11-2005, 02:34 PM

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