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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Andy Neil
08/26/05 05:40
Read: 533 times
Basingstoke
Uk


 
#100134 - Even More Pointless simulation!
Responding to: Tsuneo Chinzei'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      Vignesh Prasad      08/23/05 23:28      
   Simulate it!      Andy Neil      08/24/05 03:30      
      It is not an homework      Vignesh Prasad      08/24/05 06:07      
         Proving nothing.      Andy Neil      08/24/05 07:01      
         LCD      Andy Neil      08/24/05 07:10      
      Simulation Results      Vignesh Prasad      08/24/05 08:32      
         Pointless      Andy Neil      08/24/05 10:52      
            Got it !!      Vignesh Prasad      08/24/05 13:02      
            update      Andy Neil      08/26/05 05:43      
   do you set SCON as a byte or bitwise ?      Erik Malund      08/24/05 06:37      
   not an answer, but why do you call a fun      Erik Malund      08/24/05 07:18      
      I don't C      Jan Waclawek      08/24/05 08:06      
         inline      Andy Neil      08/24/05 08:26      
            Compiler Tries      Abhishek Singh      08/25/05 21:59      
            OT: inline, Keil ARM      Andy Neil      09/06/05 07:18      
               C99 does specify inline as a keyword.      Maarten Brock      09/06/05 10:38      
   Review index boundary value      Tsuneo Chinzei      08/26/05 02:31      
      Even More Pointless simulation!      Andy Neil      08/26/05 05:40      

Back to Subject List