|
|
View previous topic :: View next topic |
Author |
Message |
carlosma
Joined: 24 Mar 2004 Posts: 53 Location: Portugal
|
String problem with one more ENTER |
Posted: Thu Jul 22, 2004 3:40 am |
|
|
Hello
to select Write or Read data from RS232 to EEPROM, I have two functions like this:
WRITE TO EEPROM
Code: |
void anexoW(){
fprintf(COM_A, "\r\nMens Liga: ");
get_string(string, ROM_MENS_LIGA_SIZE);
write_eeprom_string(string, ROM_MENS_LIGA, ROM_MENS_LIGA_SIZE);
fprintf(COM_A, "\r\nMens Desl: ");
get_string(string, ROM_MENS_DESL_SIZE);
write_eeprom_string(string, ROM_MENS_DESL, ROM_MENS_DESL_SIZE);
//...
fprintf(COM_A, "\r\nSaved\r\n");
}
|
READ FROM EEPROM
Code: |
void anexoR(){
read_eeprom_string(s, ROM_EPASSW, ROM_EPASSW_SIZE);
fprintf(COM_A,"AT#EPASSW=\"%s\"\r\n",s);
//...
read_eeprom_string(s, ROM_EADDR, ROM_EADDR_SIZE);
fprintf(COM_A,"AT#EADDR=\"%s\"\r\n",s);
}
|
But when I call to anexoW(), never back to principal program, needs one more Enter to back. I have in my principal program a real time clock with interrupt and STOP.
I do not understand, why needs a Enter.
Thank you Carlos |
|
|
valemike Guest
|
|
Posted: Thu Jul 22, 2004 8:11 am |
|
|
I've had this problem before, not only on PIC stuff, but also PowerPC-based routers and PBXes that use serial lines to a PC or Linux workstation.
You can eliminate the extra carriage return necessary by putting in a:
This will "eat" up the pending carriage return.
-Mike
p.s. I'm not sure why it does it, but may be something to do with Hyperterminal (Windows), Kermit (Linux/Unix), etc. I'm shooting in the air, but i think it can be described as "raw" or "cooked" mode for your terminal i/o. |
|
|
valemike Guest
|
|
Posted: Thu Jul 22, 2004 8:13 am |
|
|
To be more specific,
put a "getchar()" exactly after your getstring() function call. |
|
|
carlosma
Joined: 24 Mar 2004 Posts: 53 Location: Portugal
|
|
Posted: Thu Jul 22, 2004 9:38 am |
|
|
Thank you for help
Now works
Carlos |
|
|
|
|
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
|