View previous topic :: View next topic |
Author |
Message |
mshearer
Joined: 12 Jan 2009 Posts: 33
|
getc(); |
Posted: Mon Jan 19, 2009 9:11 am |
|
|
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
|
|
Posted: Mon Jan 19, 2009 10:11 am |
|
|
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
|
|
Posted: Mon Jan 19, 2009 10:30 am |
|
|
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 |
|
|
|