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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/09/08 17:03
Read: times


 
#149201 - details
Responding to: ???'s previous message
This code is one part of a big system, there are 2 microcontrollers talk serially with each others, I write the code for one of them, they send the data from the other microcontroller as follows:
- send a byte (0x41 or 0x42 or 0x43 or 0x44 or 0x05) , I have to check the serial port till I receive this byte, if I don't receive it during certain time , I perform certain code.
- if I received the first byte, and it's really one of the previous values, I begin to receive the 16 bytes data and I have to wait till I receive all of them correctly or the system will not complete.

Now, I can receive the first byte which is 0x41, but I can't receive the 16 bytes data
* I knew that I received it from certain actions in the rest of the system on the simulator "protus"
* I used Keil to dubugg the code and it worked normally but it's not working in the system.
* I replaced the Pointer with the array itself but also it doesn't work. i.e. ==>


R_serial () interrupt 4
        {
	   if(RI)
	      {
		 serialR = SBUF;
		 CompDataRx[count]= serial;
		 ++count;
		 RI=0;
		 
	       }
	   else
		 TI = 0;
	}

void main()
{
	while(1)
           {	     
	
	     SerialInit(9600);
	     SendCompAddress();
	     for(i=0; i<=255; i++)
               {
                 CompState = SerialReceive();
        
                 switch(CompState)
                   {
                    case 0x41:
                          count = 0;
                          while(count!=15);
                          ......
.................................

		   }

*** Thank You All for Help




List of 26 messages in thread
TopicAuthorDate
Serial Problem            01/01/70 00:00      
   Can you post more information ?            01/01/70 00:00      
      more information            01/01/70 00:00      
         Too much information!            01/01/70 00:00      
         Some advice            01/01/70 00:00      
         while loop            01/01/70 00:00      
            Bad indenting trap!            01/01/70 00:00      
               Andu, Andy, how dare you ..            01/01/70 00:00      
            I don't think that's the problem.            01/01/70 00:00      
               you're right            01/01/70 00:00      
                  So, have you got it working yet?            01/01/70 00:00      
                     can't receive the 16 bytes            01/01/70 00:00      
                        Have you dealt with the atomicity issues ?            01/01/70 00:00      
                        Debugging            01/01/70 00:00      
                           details            01/01/70 00:00      
   Misleading comment            01/01/70 00:00      
      I too dislike the placement, even worse it is WRON            01/01/70 00:00      
   RI and TI are not mutually exclusive            01/01/70 00:00      
      ... but this is not a cause it will not work...            01/01/70 00:00      
         Yes...            01/01/70 00:00      
   Here is a sample code that is working ...            01/01/70 00:00      
      ... and here for the right processor            01/01/70 00:00      
         Wheel reinvention is -            01/01/70 00:00      
         I have a doubt about that KEIL code.            01/01/70 00:00      
            The Question is what do you want to loose?            01/01/70 00:00      
               No - I was just wondering the hardware            01/01/70 00:00      

Back to Subject List