<?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>Timer and serial port</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/15146/timer-and-serial-port</link><description> I am doing a project and want to use both the serial port at 2400bps and timer 0 for timing ticking. 
 
for the serial: my setting is that: 
TMOD=0x20; 
TH1=-13; 
TL1=1; 
SCON=0x50; 
 
 
for the timer: 
 
TMOD=0x01; 
TH0=(65536-5000)/256; 
TL0=(65536</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Timer and serial port</title><link>https://community.arm.com/thread/39272?ContentTypeID=1</link><pubDate>Mon, 14 Oct 2002 10:15:08 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8469c4e8-7ffc-45fe-859a-37551777d494</guid><dc:creator>Mark Odell</dc:creator><description>&lt;p&gt;Welcome to the C language. If you would like to set the upper nybble of TMOD without affecting the lower nybble of TMOD try:&lt;pre&gt;TMOD &amp;amp;= 0x0F;
TMOD |= 0x20;&lt;/pre&gt;Or if you prefer one liners&lt;pre&gt;TMOD = TMOD &amp;amp; 0x0F | 0x20;&lt;/pre&gt;Or you could make a little TMOD macro to do this, something like&lt;pre&gt;#define WRITE_TMOD_T1(nybble) do { TMOD = TMOD &amp;amp; 0x0F | (nybble) &amp;lt;&amp;lt; 4 } while (0)&lt;/pre&gt;&lt;pre&gt;
#define WRITE_TMOD_T0(nybble) do { TMOD = TMOD &amp;amp; 0xF0 | (nybble) } while (0)&lt;/pre&gt;
Usage as per your values (Note the shift left by four in the T1 macro):&lt;pre&gt;WRITE_TMOD_T1(2);
WRITE_TMOD_T0(1);&lt;/pre&gt;
TMOD should now equal 0x21. If you need a working UART driver, see my free one at &lt;a href="http://www.embeddedfw.com" target="_blank"&gt;http://www.embeddedfw.com&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Enjoy!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer and serial port</title><link>https://community.arm.com/thread/39266?ContentTypeID=1</link><pubDate>Sun, 13 Oct 2002 04:19:33 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ecca11bc-1c0d-4e40-b40f-9f8e2e01b718</guid><dc:creator>Raul Comer</dc:creator><description>&lt;p&gt;moreover,&lt;br /&gt;
i have recheck the program,&lt;br /&gt;
i found the when i put the data into the serial buuffer &lt;br /&gt;
&lt;br /&gt;
SBUF=data;&lt;br /&gt;
&lt;br /&gt;
the timer was stopped&lt;br /&gt;
&lt;br /&gt;
pls help&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>