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

getc();

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



Joined: 12 Jan 2009
Posts: 33

View user's profile Send private message

getc();
PostPosted: Mon Jan 19, 2009 9:11 am     Reply with quote

Hi all,

Code:
void main(void)
{
 while(1)
 {
  c = getc();
  printf("%c\r\n",c);
 }
}


Striped down i basically have some code doing the above. However when connect to my terminal program and send a char the results come out as

1.send (A) reponses with (<0>)
2.send (B) responses with (A)
3.send (C) responses with (B)
and so on

anyone have any idea what causes this first <0> and how i would get around it.

thanks for any help,

matthew
Guest








PostPosted: Mon Jan 19, 2009 10:11 am     Reply with quote

That code really isn't sufficient.

You need to declare the variable 'c' as,

char c;

After main() in your program. Also to get the most help - make the smallest, complete program (that compiles), fuses and all.
mshearer



Joined: 12 Jan 2009
Posts: 33

View user's profile Send private message

PostPosted: Mon Jan 19, 2009 10:30 am     Reply with quote

quite right, while cutting out all the code relating to what i thought was the problem i've found the fault.
Instead of reading RCREG once with getc() i was also reading RCREG directly in following functions, somehow causing the lag. Sorted now though,

cheers,
matt
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