Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/20/08 20:14
Modified:
  08/20/08 20:19

Read: times


 
#157597 - Am I missing something?
Responding to: ???'s previous message
Raghunathan said:
In the code with problem the while loop just freezes after displaying the first time value on LCD.

So what could be the problem ?

Thanks

Raghu



CASE _ 1: printf does not print to Serial port.

    while (1)                      // Start the Basic 100ms scan loop
    {
        if (F_ScanMain)
        {
            F_ScanMain = 0;  // Reset the looping flag which is set in interrupt.
            Pulse = ~Pulse;  // Heart beat pulse in run mode..
            if  (OneSecTik)
            {
                OneSecTik = 0;      
                ReadTime();         // Update Clock display once every sec
                sprintf( string, "  %02u %02u %02u Hrs", hour,minute, second ); 
                display(string);    // Update time in LCD
                EA = 0;                                   // Disable interrupts
                measurement =  Result * 2430 / 4095;
                printf(  "AIN0.%bu voltage: %ld \n", i,measurement); // Print mV value to RS232
                EA = 1;     // Re-enable interrupts        
            }                
        }               // F_ScanMain closing brace.
    }                      // while(1) closing brace 



Trimming your code gives this:


    while (1)                      // Start the Basic 100ms scan loop
    {
        if (F_ScanMain)
        {
            F_ScanMain = 0;  // Reset the looping flag which is set in interrupt.
                :
                : 
                :
        }               // F_ScanMain closing brace.
    }                      // while(1) closing brace 



Unless F_ScanMain is being set elsewhere in an interrupt, the if() test will pass on the first pass through the while() loop, and fail every other time thereafter.

--Rich







List of 8 messages in thread
TopicAuthorDate
printf problem            01/01/70 00:00      
   Horrible formatting            01/01/70 00:00      
   printf problems            01/01/70 00:00      
   Please show the complete program            01/01/70 00:00      
      Still no luck..            01/01/70 00:00      
         Well ...            01/01/70 00:00      
            Problem solved            01/01/70 00:00      
   Am I missing something?            01/01/70 00:00      

Back to Subject List