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.
Hi all, I am trying to get an integer number as input through serial window.To do that I wrote the program below and it didnt work.The problem is with Scanf.Is it correct to give scanf the way that i have given in my program.... when i treid to build i got the following error
#include <stdio.h> #include <LPC21xx.H> void main (void) { int a; int b; int c; /* initialize the serial interface */ PINSEL0 = 0x00050000; /* Enable RxD1 and TxD1 */ U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */ U1DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */ U1LCR = 0x03; /* DLAB = 0 */ printf ("Enter the value of a b c\n"); scanf ("%d %d %d", &a, &b, &c); }
There is a mistake in the SERIAL.C. For using scanf, you need to define a _getkey function. Once you rename getchar into _getkey everything will be just fine. See also: http://www.keil.com/support/docs/3131.htm Reinhard