Can someone help me get this to work? I want to be able to receive an input on the serial window and then display that input. The problem is the first text repeats forever with a while loop, and without a loop the program displays text but doesn't respond at all. What am I doing wrong? It seems like this should be simple.
#include<stdio.h> #include <reg51.h> //Used for serial interface int main () { char string [50]; //Required for Serial Interface SCON = 0x52; // serial port configuration TMOD = 0x20; TCON = 0x40; TH1 = 0xf3; // 2403 baudrate @12mhz //while (1) { printf ("Insert sentence: "); gets (string); printf ("Your sentence is: %s",string); //return 0; //} }