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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Vignesh Prasad
08/23/05 23:28
Read: 940 times

Msg Score: -1
 -1 Looks like homework
#99942 - More encounters with Keil C51
(Hoping this is a new subject, so I am starting a new thread)

Hi all, just look into the following code:

char packet[10];
unsigned char byte_no=0;
bit bdata txbit=0, rxbit=0, end_comm=0;

void serial(void) interrupt 4
       if(TI)    txbit=1;

void comhandle(void)
      byte_no++;  //suspicion

void main(void)

What happens is that, the first byte of 10 byte serial packet never gets stored in packet[0]. What I suspect is, byte_no++ instruction gets evaluated in the first run, before the main function is called. So when a byte arrives, byte_no has value of 1. Will this happen? comhandle() function is supposed to run only when the microcont receives a serial byte. Any suggestions?

Thanks and Regards,

List of 18 messages in thread
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