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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/26/05 11:40
Read: times


 
#100134 - Even More Pointless simulation!
Responding to: ???'s previous message
Tsuneo Chinzei said:
Thus, packet[9] is never visited, packet[0] is overwritten.

This is another bug that he fixed in his simulation:
Original Code Posted                    |  What he simulated
________________________________________|_______________________________________________
                                        |
                                        |  #define PACKETLEN  5
                                        |  void comhandle(void);
                                        |
char packet[10];                        |  unsigned char combuf[PACKETLEN]; //com buffer
unsigned char byte_no=0;                |  unsigned char bufcntr=0;
                                        |
bit bdata txbit=0, rxbit=0, end_comm=0; |
                                        |
void serial(void) interrupt 4           |  void serialhandler(void) interrupt 4
{                                       |  {
       if(TI)    txbit=1;               |     TI=0;
       if(RI)                           |     if(RI)
       {                                |     {
            rxbit=1;                    |
            comhandle();                |         comhandle();
                                        |         RI=0;
       }                                |     }
}                                       |  }
                                        |
void comhandle(void)                    |  void comhandle(void)
{                                       |  {
      packet[byte_no]=SBUF;             |     combuf[bufcntr]=SBUF;
      byte_no++;  //suspicion           |     bufcntr++;
                                        |
      if(byte_no==9)                    |     if(bufcntr>=PACKETLEN)
      {                                 |     
           byte_no=0;                   |        bufcntr=0;
           end_comm=1;                  |  
      }                                 |
}                                       | }
Simulating something that's different from what's actually running in the target is pointless - simulating something that's significantly different is doubly so!




List of 18 messages in thread
TopicAuthorDate
More encounters with Keil C51            01/01/70 00:00      
   Simulate it!            01/01/70 00:00      
      It is not an homework            01/01/70 00:00      
         Proving nothing.            01/01/70 00:00      
         LCD            01/01/70 00:00      
      Simulation Results            01/01/70 00:00      
         Pointless            01/01/70 00:00      
            Got it !!            01/01/70 00:00      
            update            01/01/70 00:00      
   do you set SCON as a byte or bitwise ?            01/01/70 00:00      
   not an answer, but why do you call a fun            01/01/70 00:00      
      I don't C            01/01/70 00:00      
         inline            01/01/70 00:00      
            Compiler Tries            01/01/70 00:00      
            OT: inline, Keil ARM            01/01/70 00:00      
               C99 does specify inline as a keyword.            01/01/70 00:00      
   Review index boundary value            01/01/70 00:00      
      Even More Pointless simulation!            01/01/70 00:00      

Back to Subject List