Hi, I am interfacing PC + DS89C450 + GPRS where I will send AT command from PC terminal (serial port 0) and DS89C450 will send the command to gprs modem (via serial port 1). Then the reply will go from gprs modem -> DS89C450-> PC terminal.
Now serial port0 works fine with the following configuration.
/**********Serial port initialization**************************/ SCON0 = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */ TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */ TH1 = 252; /* TH1: reload value for 14400 baud @ 22.1184MHz */ TR1 = 1; /* TR1: timer 1 run */ TI_0 = 1; /* TI: set TI to send first char of UART */ /************End of serial port initialization****************/
But For same settings (SCON1 instead of SCON0) serial port 1 doesn't work. I send scanf and printf command to serial port 0 which works fine .But for Serial port 1 it doesn't work.
What am I missing? How printf and scanf can be used/configured for second UART?
Please suggest me.
Thank you.
http://www.keil.com/support/man/docs/c51/c51_printf.htm
Hi, Thanks a lot for your reply. I got the following clue in printf doc.
This function is implementation-specific and is based on the operation of the _getkey and putchar functions. These functions, as provided in the standard library, read and write characters using the microcontroller's serial port. Custom functions may use other I/O devices.
I am trying to make it work.