View previous topic :: View next topic |
Author |
Message |
rngolding
Joined: 07 Sep 2003 Posts: 8 Location: Shrewsbury, UK
|
Unwanted RS232 Echo |
Posted: Thu Mar 24, 2011 9:12 am |
|
|
Hi,
I'm having problems with the CCS 'get_string' function. When I read in a series of characters (on the RX port), each character is echoed back from the TX port as they are typed. Is this usual or even expected?
I don't want the characters echoed back - is there a way of acheiving this?
Ive posted a snippet of code below, which produces the unwanted echo from the TX port.
Code: |
#include <18F4423.h>
#fuses HS,NOWDT,NOLVP
#use delay(clock=16000000)
#use rs232(baud=57600,xmit=PIN_C6,rcv=PIN_C7)
#include <input.c>
char message[9]; //Input string
void main(void)
{
while(1)
{
get_string(message,8); //Get input string
if (message[0]=='?')
printf("Got a ?\r\n"); //send "?" if received, else do nothing
}
}
|
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Thu Mar 24, 2011 9:19 am |
|
|
The source code for the get_string function, is in input.c.....
It is designed for 'user input'. I.e. somebody typing the string in. So it echos the string to the display.
To just read the input without echoing, just copy the code call it something like 'my_get_string', and remove the putc instructions from it (four of them).
Best Wishes |
|
|
rngolding
Joined: 07 Sep 2003 Posts: 8 Location: Shrewsbury, UK
|
|
Posted: Fri Mar 25, 2011 3:16 am |
|
|
Thanks Ttelmah - that works fine.
Best Regards |
|
|
|