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 17:08
Read: times


 
#157581 - printf problem
I have Silabs F020 develoopment kit and trying to acquire through ADCO.

The sample program that ships with the Silabs IDE for ADC0_MUX works fine and I am able to see the values in the HyperTerminal. No problems. But when I port the same code and merge it with my Main that has an LCD also, the code freezes without displaying anything on the HyperTerminal.

Both the good and problem snippets are given below :
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[i] * 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 

================================================================

CASE_2 : printf prints fine to Serial port.

 while (1)
        {
            EA = 0;            // Disable interrupts
            measurement =  Result[i] * 2430 / 4095;
            printf(  "AIN0.%bu voltage: %ld \n",  i,measurement);// Print mV value to RS232
            EA = 1;            // Re-enable interrupts
            Wait_MS(SampleDelay); // Wait before displaying new values
        }
===============================================================


If you observe, the code that has a problem has the LCD display to update. Otherwise both are same. The UART0 config, baud rate, ADCO config etc, all are same in both cases. In the code with problem the while loop just freezes after displayingt the first time value on LCD.

So what could be the problem ?

Thanks

Raghu
PS : Sorry for the horrible formatting. Cut-paste in Notepad is the root cause....

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