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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/02/09 05:50
Read: times


 
#165722 - s/w delay function
Hello,
I am having 8052 based project. I am using Keil Microvision 3 compiler and am using PC-Lint for error checking and debugging. I am using simple software delay function in my project code as follows:

#include<Reg52.h> /* Keil header file for 8052 variants */

void swdelay(void)
{ /* This is simple software delay generation function */
unsigned char i;

for(i=255;i;i--) ;
for(i=255;i;i--) ;
}

/* This function sends the val to Serial Buffer SBUF of 8051 and waits for some time for the data to be sent. SBUF is defined in Reg52.h header file of Keil. sfr SBUF = 0x99; */

void sendAndWait(unsigned char val)
{
SBUF = val;
swdelay();
}
Keil compilation is ok. The program is running fine and the delay is also generated. But, PC-Lint is generating the Warning:
"Warning 522: Highest operation, function 'sdelay', lacks side-effects" at the swdelay() calling line.

Q: I had gone thro PC-Lint pdf file and read the 522 related information, pure function and many more. But, I didn't understand what is the wrong with this function.
Please suggest.

thanks.

List of 30 messages in thread
TopicAuthorDate
s/w delay function            01/01/70 00:00      
   Software loops can be optimized away            01/01/70 00:00      
   lacks side-effects            01/01/70 00:00      
      First time with LINT?            01/01/70 00:00      
   lacks side-effects            01/01/70 00:00      
      That does not mean it is an error.            01/01/70 00:00      
      It also blocks            01/01/70 00:00      
   How to post legible source code            01/01/70 00:00      
   DELAY_0.1.ZIP Useful?            01/01/70 00:00      
      That doesn't help, and it won't work anyhow!            01/01/70 00:00      
         I stand by it.            01/01/70 00:00      
            Yes a delay function is useful            01/01/70 00:00      
               wrong !!!!            01/01/70 00:00      
               No, that's precisely where you're wrong            01/01/70 00:00      
            How can you say that?            01/01/70 00:00      
               I think you should read Murray's comments            01/01/70 00:00      
                  I have seen ...            01/01/70 00:00      
                     Timers usable without start/stop too            01/01/70 00:00      
                        free-running counter/timer            01/01/70 00:00      
                           Unsigned integers            01/01/70 00:00      
                              re: unsigned            01/01/70 00:00      
                                 Try unsigned subtraction with borrow            01/01/70 00:00      
                                 bug in second (improved!?) code block            01/01/70 00:00      
   Delay Loops in 'C'..!!! NO            01/01/70 00:00      
      Go on. Suggest a SIMPLE alternative            01/01/70 00:00      
         My Methods            01/01/70 00:00      
            So he has a long list of constraints            01/01/70 00:00      
               oh boy what a load who wil have 10 minutes for this            01/01/70 00:00      
                  Ok. I was being naughty.            01/01/70 00:00      
                     you forget the obvious ...            01/01/70 00:00      

Back to Subject List