<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Problems with second serial port</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/37794/problems-with-second-serial-port</link><description> 
Hi All, 
I am using TI MSC1212Y5 8-bit micro controller. It has 2 serial
ports. I am trying to operate them independently. I am able to
transmit the data on both ports. But I am unable to receive the data
from second serial port(UART1). 
I have written</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/147403?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2008 01:57:03 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:67d6a7c8-a9ca-41f2-a6aa-f7f81aa9d122</guid><dc:creator>Miss Embededd</dc:creator><description>&lt;p&gt;&lt;p&gt;
Warning - My stack has overflowed !!!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/146192?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2008 01:56:23 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e3d8cc1c-91d4-4b5d-92a1-372f293b87f0</guid><dc:creator>Miss Embededd</dc:creator><description>&lt;p&gt;&lt;p&gt;
Ooooooohhhhhhhhhh ... I can&amp;#39;t take any more!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/144380?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2008 01:53:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:43d9a7d7-55cb-407f-b73f-30dbbc6045b1</guid><dc:creator>Catcus Blip</dc:creator><description>&lt;p&gt;&lt;p&gt;
you should see me bake a cake :)&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/141997?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2008 01:51:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d3b69ed4-4df5-4c01-8a41-4ac536dddbc2</guid><dc:creator>Miss Embededd</dc:creator><description>&lt;p&gt;&lt;p&gt;
Each romp takes five minutes.&lt;/p&gt;

&lt;p&gt;
You add one post each 4 minutes.&lt;/p&gt;

&lt;p&gt;
There is no option except for re-entry!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/138759?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2008 01:49:24 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3a2c9783-f365-4dd6-960a-2d6a4f6f9f03</guid><dc:creator>Catcus Blip</dc:creator><description>&lt;p&gt;&lt;p&gt;
Ameya,&lt;br /&gt;
I am not a C51 guy actually, but did you check that your peripherals
(UART, interrupt controller (do you even have one???) are configured
to generate an interrupt for the second UARTs? did you check your
interrupt masks?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/138757?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2008 01:45:39 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1130e0d4-50c9-4e3b-baa3-6dcd9fd8250a</guid><dc:creator>Catcus Blip</dc:creator><description>&lt;p&gt;&lt;p&gt;
Miss Embededd,&lt;br /&gt;
Are you my STR9? that would explain why the darn this keeps crashing
:) :) :)&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/138756?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2008 01:43:33 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:baab8881-c97b-4436-979f-058f48446312</guid><dc:creator>Catcus Blip</dc:creator><description>&lt;p&gt;&lt;p&gt;
Keep romping!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/130307?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2008 01:36:42 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8f2311ce-637f-4302-8b19-ed434a5005fb</guid><dc:creator>Miss Embededd</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;Am I not adorable...?&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Tamir,&lt;/p&gt;

&lt;p&gt;
Whenever I read one of your posts I have an unmaskable urge to
interrupt my normal operation and execute a five minute romp!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/130305?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2008 01:34:27 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:03cfadcd-fc76-4567-ae3e-363d3b2591df</guid><dc:creator>Ameya Hardikar</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks a lot Tamir,&lt;br /&gt;
Yes I have gone through the printf related links and the problem of
using printf with both ports has been solved.&lt;/p&gt;

&lt;p&gt;
But now my problem is i am not able to receive data on second
serial port. RI_1 is not setting high at all. I have tried using
_getkey() function.. but its poling function. I want INTR driven
routine. Could you please suggest me any solution???Why my INTR
driven routine is not working?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/124634?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2008 00:55:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ce157887-d811-4ff2-a908-7c2f99a45d2f</guid><dc:creator>Catcus Blip</dc:creator><description>&lt;p&gt;&lt;p&gt;
See &lt;a href="http://www.keil.com/support/docs/788.htm"&gt;http://www.keil.com/support/docs/788.htm&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/124624?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2008 00:51:42 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c659ed05-2b9c-4a3f-a642-e34b64bd1c2d</guid><dc:creator>Catcus Blip</dc:creator><description>&lt;p&gt;&lt;p&gt;
Ameya,&lt;br /&gt;
You &lt;b&gt;&lt;i&gt;must read&lt;/i&gt;&lt;/b&gt; the comments regarding printf as
recommended by Per...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/113878?ContentTypeID=1</link><pubDate>Wed, 30 Apr 2008 00:39:29 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d57bbf97-d6ce-491e-9a1e-cba064e20389</guid><dc:creator>Ameya Hardikar</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hello all, I have copied and pasted the code here ..Pls let me
know what&amp;#39;s wrong with this INTR routine..coz I am unable to receive
data on second serial port. RI_1 is not activating at all.&lt;/p&gt;

&lt;pre&gt;
#include &amp;quot;reg1212.h&amp;quot;
#include &amp;quot;stdio.h&amp;quot;

#define SET 1
#define RESET 0

unsigned char ch_0,ch_1;
extern unsigned char port;

void init_port();
void send_out_0(unsigned char);
void init_port1();
void send_out_1(unsigned char out1);

unsigned char port;

void main()
{

init_port();
init_port1();
flag=0;
// IE=0x60;
 // IP=0x60;

EA=1;
while(1) {

    //Read character from UART1 and Transmit over UART0

           while(!ch_1);
           send_out_0(ch_1);
           ch_1=0;

  //Read character from UART0 and Transmit over UART1

           while(!ch_0);
           send_out_1(ch_0);
           ch_0=0;

        }

}


void init_port()
{

   P3DDRL|=0x07; //Define port3 for alternate fucntions     P3.0=RXD and P3.1=TXD

  SCON=0x50; //Rcv enable mode2 1 start bit 8Data bits 1 Stop bit. RCAP2H=0xFF; //To generate baud rate of 9600 ..clk 25Mhz

  RCAP2L=0xAD;
  T2CON=0x34; //timer2 enabled for Baud generation of  both Rx and Tx
   ES0=1; //Enable serial0 INTR
// EA=1;
// TI_0=1; //To initiate first character Xmission

}

//-----------------ISR for UART0-

void serial_Intr_0(void)interrupt 4
{
    if(RI_0==1)
    {
       ch_0=SBUF0;
       RI_0=0;


     }

else if(TI_0==1)
    {

           TI_0=0;

    }
}


void send_out_0(unsigned char out)
{
   SBUF0=out;
   while(TI_0==0); //Wait while char is Xmitted
   TI_0=0;
}

void init_port1()
{
   P1DDRL|=0x70;
   SCON1=0x50;
   TH1=0XEC; //9600 Baud rate
   CKCON|=0x10;
   TMOD|=0X20; //Timer1 mode 2
   TR1=1;
   ES1=1;
// TI_1=1;
// EA=1;

}

void send_out_1(unsigned char out1)
{

   SBUF1=out1;
   while(TI_1==0); //Wait while char is Xmitted
   TI_1=0;
}

//----------------------------ISR for 1(UART1)--------------------------------------------------
void serial_Intr_1(void)interrupt 7
{

   if(RI_1==1)
   {
      ch_1=SBUF1;
      RI_1=0;
   }

else if(TI_1==1)
  {
     TI_1=0;

  }
}
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/100583?ContentTypeID=1</link><pubDate>Tue, 29 Apr 2008 22:49:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:30df98e7-5b98-4b46-9ad5-968fbc7d9160</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;which I have posted above?&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
You posted it but, as already mentioned, you didn&amp;#39;t read the
instructions on how to post source code - so it&amp;#39;s illegible.&lt;/p&gt;

&lt;p&gt;
The instructions are quite clear &amp;amp; easy:&lt;br /&gt;
&lt;a href="http://www.danlhenry.com/caps/keil_code.png"&gt;www.danlhenry.com/.../keil_code.png&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
Don&amp;#39;t manually re-type the code into the post - use only
copy-and-paste;&lt;/p&gt;

&lt;p&gt;
Note that TABs don&amp;#39;t work (well) - use spaces instead,&lt;/p&gt;

&lt;p&gt;
and don&amp;#39;t forget to check it in the &amp;#39;&lt;b&gt;Preview&lt;/b&gt;&amp;#39;...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/76241?ContentTypeID=1</link><pubDate>Tue, 29 Apr 2008 22:16:23 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:363ee651-afd7-4cda-86bc-d61a89031890</guid><dc:creator>Ameya Hardikar</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanx a lot. I will read those threads. But could you please tell
me whats wrong with my INTR driven routine which I have posted
above?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/89030?ContentTypeID=1</link><pubDate>Tue, 29 Apr 2008 22:07:54 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d710bbc3-2fb6-48bd-b2ba-bd4b7f3185eb</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
By the way: Have you read the instructions how to post source
code? Whenever you make a post, the input form have a description
about how to include source.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems with second serial port</title><link>https://community.arm.com/thread/51722?ContentTypeID=1</link><pubDate>Tue, 29 Apr 2008 22:05:37 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4237aa22-3ccb-4d9c-9898-b81d872b73f3</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Have you tried to &lt;b&gt;search&lt;/b&gt; on this forum about the use of
printf with multiple serial ports? If you search for existing
answers, people don&amp;#39;t have to spend time to answer again, and again
;)&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>