We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
#include <stdio.h> #include <reg51.h>
unsigned char a[20];
void main(void) { SCON = 0x52; TMOD = 0x20; TCON = 0x40; TH1 = 0xf3;
printf("enter any sentence:"); _gets(a,20); _puts(a); }
i am a beginner for keil compiler trying to echo the data entered by the user, i tried various methods to do it but could not see the result on the serial window.
my assignment is getting the data from the user and echoing back to the stdout that is screen as many times as the user requests
You normally do echo a character at a time to make sure that the user doesn't have to write blindly a full line of text (including enter) before anything gets visible.
Line-based is also limited to your buffer size, while a character at a time means you can handle a text line with a million characters.