CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Another serial question

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jacqueskleynhans



Joined: 10 Apr 2008
Posts: 109
Location: Cape Town, South Africa

View user's profile Send private message

Another serial question
PostPosted: Tue Feb 08, 2011 10:18 am     Reply with quote

HI Guys I have a issue reading in more than two serial bytes.

Code:
BOOLEAN waitForResponse( int32 timeout, byte buffer[], int8 bufferLength )
{
  int8 byteCnt = 0;
  int32 time = 0;
 
    while(kbhit(CAMERA)&&(++time<timeout))
   {
      buffer[byteCnt] = fgetc(CAMERA);

      if( byteCnt == bufferLength )
      {
        return (1);
      }
   byteCnt++;      
   }   
      return (0);
}


I'm reading in a total of 6 bytes of which the first two are always correct but the last four are garbage.

Any suggestions ??

Thx
_________________
"THE ONLY EASY DAY WAS YESTERDAY"
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Tue Feb 08, 2011 10:25 am     Reply with quote

Hi,

Yes, two suggestions:

1. Add the ERRORS directive to your #Use RS232 statement
2. Read the forum everyday as this and other similar problems are covered repeatedly here....

John
jacqueskleynhans



Joined: 10 Apr 2008
Posts: 109
Location: Cape Town, South Africa

View user's profile Send private message

int_rda
PostPosted: Tue Feb 08, 2011 1:49 pm     Reply with quote

Thx I will try and set up a int driven routine.

Regards
_________________
"THE ONLY EASY DAY WAS YESTERDAY"
jacqueskleynhans



Joined: 10 Apr 2008
Posts: 109
Location: Cape Town, South Africa

View user's profile Send private message

PostPosted: Wed Feb 09, 2011 1:57 pm     Reply with quote

Ok I solved the problem by adding an isr for my serial bit sream that the pic receives.
_________________
"THE ONLY EASY DAY WAS YESTERDAY"
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group