This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

missing pulse detectar

i must have the code for detecting a missin g pulse?
do some one have some for me to see?

Parents
  • robhan visan,

    A way to detect it is to monitor the pulses, determine the time between them, and then determine if a pulse is missing based upon the expected time it should have occurred.

    Pseudo-code:

        if( pulse )
        {
            capture time
    
            difference in time = (current time) - (previous time);
    
            if( difference > expected time )
            {
                missing pulse has occured
            }
            else
            {
                missing pulse has not occured
            }
        }
    

    a close 'C' approximation:

    
    #define EXPECTED_TIME_BETWEEN_PULSES    50  // >50ms means too much time
    
    void pulse_isr( void ) // a logic pulse interrupts CPU
    {
        static unsigned int current_time  = 0;
        static unsigned int previous_time = 0;
        int difference;
    
        current_time = Get_Timestamp( ); // needs a timing routine accessor
    
        difference = ( current_time - previous_time );
    
        if( difference > EXPECTED_TIME_BETWEEN_PULSES )
        {
            Flag_Missing_Pulse = TRUE;  // the flag that say's "Missing"
        }
        else
        {
            Flag_Missing_Pulse = FALSE;
        }
    
        previous_time = current_time;   // for next time
    
    
    }
    

    This example will let you know that a missing pulse occurred one pulse AFTER it has been 'missed.'

    There are better ways to do this, but this is just an example.

    I hope you get a good grade on this assignment.

    NOTE: Per still needs some redeeming... his "H follows G" rule doesn't account for the field-tested sobriety research data collected over the past 30+ years. So the real-world missing pulse detector must not rely on this H-G relationship.

    --Cpt. Vince Foster
    2nd Cannon Place
    Fort Marcy Park, VA

    P.S. FYI... I found Jack's photo...

    inpraiseofsardines.typepad.com/.../sardine_man_1.jpg

Reply
  • robhan visan,

    A way to detect it is to monitor the pulses, determine the time between them, and then determine if a pulse is missing based upon the expected time it should have occurred.

    Pseudo-code:

        if( pulse )
        {
            capture time
    
            difference in time = (current time) - (previous time);
    
            if( difference > expected time )
            {
                missing pulse has occured
            }
            else
            {
                missing pulse has not occured
            }
        }
    

    a close 'C' approximation:

    
    #define EXPECTED_TIME_BETWEEN_PULSES    50  // >50ms means too much time
    
    void pulse_isr( void ) // a logic pulse interrupts CPU
    {
        static unsigned int current_time  = 0;
        static unsigned int previous_time = 0;
        int difference;
    
        current_time = Get_Timestamp( ); // needs a timing routine accessor
    
        difference = ( current_time - previous_time );
    
        if( difference > EXPECTED_TIME_BETWEEN_PULSES )
        {
            Flag_Missing_Pulse = TRUE;  // the flag that say's "Missing"
        }
        else
        {
            Flag_Missing_Pulse = FALSE;
        }
    
        previous_time = current_time;   // for next time
    
    
    }
    

    This example will let you know that a missing pulse occurred one pulse AFTER it has been 'missed.'

    There are better ways to do this, but this is just an example.

    I hope you get a good grade on this assignment.

    NOTE: Per still needs some redeeming... his "H follows G" rule doesn't account for the field-tested sobriety research data collected over the past 30+ years. So the real-world missing pulse detector must not rely on this H-G relationship.

    --Cpt. Vince Foster
    2nd Cannon Place
    Fort Marcy Park, VA

    P.S. FYI... I found Jack's photo...

    inpraiseofsardines.typepad.com/.../sardine_man_1.jpg

Children