<?xml version="1.0" encoding="utf-8" ?>
				<!-- generator="e107" -->
				<!-- content type="Forum / topic" -->
				<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
				<channel rdf:about="http://www.8051projects.net/">
				<title>8051 Microcontroller Projects AVR PIC Projects Tutorials Ebooks Libraries codes : Forum / topic</title>
				<link>http://www.8051projects.net/</link>
				<description>Learn to make simple microcontroller projects, pic, 8051, avr and arm projects. download 8051 projects, tutorials, libraries, sample codes. join the microcontroller discussion forum and ask doubts regarding electronics. the best source for 8051 over internet.</description>
				<dc:language>en-gb</dc:language>
				<dc:date>2009-01-07T22:15:04-08:00</dc:date>
				<dc:creator>contact@nospam.com</dc:creator>
				<admin:generatorAgent rdf:resource="http://e107.org" />
				<admin:errorReportsTo rdf:resource="mailto:contact@nospam.com" />
				<sy:updatePeriod>hourly</sy:updatePeriod>
				<sy:updateFrequency>1</sy:updateFrequency>
				<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
				<items>
				<rdf:Seq>
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t4311.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t4311.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t4311.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t4311.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t4311.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t4311.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t4311.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t4311.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t4311.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t4311.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t4311.html" />
				</rdf:Seq>
				</items>
				</channel>
						<item rdf:about="http://www.8051projects.net/forum-t4311.html">
						<title>ARM tutorial :  UART</title>
						<link>http://www.8051projects.net/forum-t4311.html</link>
						<dc:date>2009-01-07T22:15:04-08:00</dc:date>
						<dc:creator></dc:creator>
						<dc:subject></dc:subject>
						<description>topics to be discussed1. selction of pins for different function.2. setting PLL .3.setting baud rate.4.sending a byte of data.5. receiving a byte of data.6. using in interrupt.7.difference between polled and interrupt mode any thing u wanna add??</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t4311.html">
						<title>Re: ARM tutorial :  UART</title>
						<link>http://www.8051projects.net/forum-t4311.html</link>
						<dc:date>2009-01-07T22:15:04-08:00</dc:date>
						<dc:creator>vinay1277</dc:creator>
						<dc:subject></dc:subject>
						<description>A small example programme to learn and test communication on hyperterminal . If till tomorrow i i could understand and test it on my board then i will feel bit satisfied I believe you have made a proper list of topics further .CODE:/* Include header file depending upon device been used */<br />#include&lt;Philips\LPC2148.h><br />void Initialize&#40;void&#41;;<br />/* Macro Definitions */<br />#define TEMT (1&lt;&lt;6)<br />#define LINE_FEED 0xA<br />#define CARRIAGE_RET 0xD<br />/************************* MAIN *************************/<br />int main&#40;&#41;<br />&#123;<br />int i;<br />char c&#91;&#93;="Philips LPC";<br />Initialize&#40;&#41;<br />/* Print forever */<br />while&#40;1&#41;<br />&#123;<br />i=0;<br />/* Keep Transmitting until Null character('\0') is reached */<br />while&#40;c&#91;i&#93;&#41;<br />&#123;<br />U0THR=c&#91;i&#93;;<br />i++;<br />&#125;<br />U0THR=LINE_FEED;<br />U0THR=CARRAIGE_RET;<br />/* Wait till U0THR and U0TSR are both empty */<br />while&#40;!&#40;U0LSR &amp; TEMT&#41;&#41;&#123;&#125;<br />&#125;<br />&#125;<br />/*************** System Initialization ***************/<br />void Initialize&#40;&#41;<br />&#123;<br />/* Initialize Pin Select Block for Tx and Rx */<br />PINSEL0=0x5;<br />/* Enable FIFO's and reset them */<br />U0FCR=0x7;<br />/* Set DLAB and word length set to 8bits */<br />U0LCR=0x83;<br />/* Baud rate set to 9600 */<br />U0DLL=0x10;<br />U0DLM=0x0;<br />/* Clear DLAB */<br />U0LCR=0x3;<br />&#125;<br />/*********************************************************/<br /><br /><br />&nbsp;</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t4311.html">
						<title>Re: ARM tutorial :  UART</title>
						<link>http://www.8051projects.net/forum-t4311.html</link>
						<dc:date>2009-01-07T22:15:04-08:00</dc:date>
						<dc:creator>vinay1277</dc:creator>
						<dc:subject></dc:subject>
						<description>Slow and steady wins the race . You be slow and i am going to be steady . Ultimately we all will win.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t4311.html">
						<title>Re: ARM tutorial :  UART</title>
						<link>http://www.8051projects.net/forum-t4311.html</link>
						<dc:date>2009-01-07T22:15:04-08:00</dc:date>
						<dc:creator>vinay1277</dc:creator>
						<dc:subject></dc:subject>
						<description>I am looking forward for elaborate explanation on above subtopics . I do miss a lot words while typing a post and send it without checking . Please ignore myomissions.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t4311.html">
						<title>Re: ARM tutorial :  UART</title>
						<link>http://www.8051projects.net/forum-t4311.html</link>
						<dc:date>2009-01-07T22:15:04-08:00</dc:date>
						<dc:creator>shyam</dc:creator>
						<dc:subject></dc:subject>
						<description>wow u r really being quick i wud prefer to take a step a time...moreover it is always better to set PLL than using its default value....we will certainly try to get ur programme running....1. selction of pins for different function.in lpc as u might have noticed one pin can be configured to serve as 4 different funtions  ex.P0.1/RXD0/PWM3/EINT0   it is one single pin..these functions lets say are fun0 fun1 fun2 fun3.edited[P1 in lpc21xx donot have special functions they have just fun0 and fun1.things to note:  we r not considering JTAG yet..   actually PINSEL2 is the PINSEL associated for P1 butfun1 is related for JTAG debug.. Pins 0 through 15 of port 1 are not available.]in all cases  fun0 is GPIOby default (unless the functionality is selected  all pins have this fun0).the functionality can be configured by using PINSEL register (32 bit).edited[thus it wud be clear by now that P1 does not have a PINSEL corresponding to it....oops!! forgot pinsel2   plz ignore this line     ]in binary the functions can be numbered as 0  00                                                                      1  01                                                                      2 02                                                                      3 03each pin thus has two pinsel bits corresponding to it..thus it wud be clear now ..  for 32 bit Port 1   2 PINSEL registers wud be required..they are PINSEL0 &amp; PINSEL1.now to ajay's code.      CODE:<br />void Initialize&#40;&#41;<br />&#123;<br />/* Initialize Pin Select Block for Tx and Rx */<br />PINSEL0=0x5;<br />&nbsp; writing 0x5 in binary  we get..    0x 01 01the first two bits determine the function chosen for P0.0  i.e. fun1  => UART0 TXD0similarly the next two  bits determine the function chosen for P0.1  i.e. fun1  => UART0 RXD0thus ajay has selected his pair of RX/TX</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t4311.html">
						<title>Re: ARM tutorial :  UART</title>
						<link>http://www.8051projects.net/forum-t4311.html</link>
						<dc:date>2009-01-07T22:15:04-08:00</dc:date>
						<dc:creator>shyam</dc:creator>
						<dc:subject></dc:subject>
						<description>@vinayplease go through this pagehttp://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/WinARM_20060117_readme.html</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t4311.html">
						<title>Re: ARM tutorial :  UART</title>
						<link>http://www.8051projects.net/forum-t4311.html</link>
						<dc:date>2009-01-07T22:15:04-08:00</dc:date>
						<dc:creator>shyam</dc:creator>
						<dc:subject></dc:subject>
						<description>please note P0.31 is GPO Port only  i.e. cannot be configured as input!it is generally used as USB good link led signal!!</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t4311.html">
						<title>Re: ARM tutorial :  UART</title>
						<link>http://www.8051projects.net/forum-t4311.html</link>
						<dc:date>2009-01-07T22:15:04-08:00</dc:date>
						<dc:creator>shyam</dc:creator>
						<dc:subject></dc:subject>
						<description>2. setting PLL .The PLL is used to multiply the external crystal frequency up to the maximum 60 MHz. Itis controlled by the constants M and P.Within the PLL are two constants which must be programmed in order to determine the clock for the CPU and AHB. This clock is called Cclk. The first constant is a straightforward multiplier of the external crystal. The output frequency of the PLL is given by:Cclk = M x OscIn the feedback path of the PLL is a current-controlled oscillator which must operate in the range 156MHz – 320MHz.. The second constant acts as a programmable divider which ensures that the CCO is kept in specification.The operating frequency of the CCO is defined as:Fcco = Cclk x 2 x Pwell i had already submitted a design for lpc2138/48   if u find it ... u wud notice the crystall of frequency 14.745 Mhz.so  - System should run at max. Frequency (60MHz) [limit: max 60 MHz]   - Choose multiplier M=4      so cclk = M * F_OSC= 4 * 14745000Hz = 58980000 Hz - F_CCO must be inbetween the limits 156 MHz to 320 MHz     datasheet: F_CCO = F_OSC * M * 2 * P   - choose devider P=2 => F_CCO = 14745000Hz * 4 * 2 * 2     = 235920000 ~=236 MHznow you can choose the multiplier and devider value for PLL depending on your crystall</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t4311.html">
						<title>Re: ARM tutorial :  UART</title>
						<link>http://www.8051projects.net/forum-t4311.html</link>
						<dc:date>2009-01-07T22:15:04-08:00</dc:date>
						<dc:creator>shyam</dc:creator>
						<dc:subject></dc:subject>
						<description>please note: There are two PLL modules in the LPC2141/2/4/6/8 microcontroller. The PLL0 is used togenerate the CCLK clock (system clock) while the PLL1 has to supply the clock for theUSB at the fixed rate of 48 MHz. Structurally these two PLLs are identical with exceptionof the PLL interrupt capabilities reserved only for the PLL0. so @ ajay...u should configure the PLL first...lets see how to do it=>>></description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t4311.html">
						<title>Re: ARM tutorial :  UART</title>
						<link>http://www.8051projects.net/forum-t4311.html</link>
						<dc:date>2009-01-07T22:15:04-08:00</dc:date>
						<dc:creator>shyam</dc:creator>
						<dc:subject></dc:subject>
						<description>take a look at the code...CODE:<br />#define FOSC&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 14745000 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp;/*on board crystall frequency */<br />#define PLL_M&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; 4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp;/*Cclk = M x Osc &nbsp;Cclk =60Mhz &nbsp;Osc 14.745 Mhz M~4 &nbsp; */<br />#define MSEL&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (PLL_M-1)<br />#define PSEL0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 &nbsp; &nbsp; &nbsp; <br />&nbsp;/*see user manual PLLCFG*/<br />#define PSEL1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 6 &nbsp; <br />&nbsp;/*see user manual*/<br /><br />#define PLLE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0<br />&nbsp;/*see user manual PLLCON*/<br />#define PLLC&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; <br />&nbsp;/*see user manual PLLCON*/<br /><br />#define PLOCK&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; 10 &nbsp; <br />&nbsp;/*see user manual PLLSTAT*/<br /><br />#define PLL_FEED1&nbsp; &nbsp; &nbsp; &nbsp;0xAA &nbsp; <br />&nbsp;/*constant*/<br />#define PLL_FEED2&nbsp; &nbsp; &nbsp; &nbsp;0x55 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp;/*constant*/<br /><br /><br />void systemPllInit&#40;void&#41;<br />&#123;<br />&nbsp; &nbsp; &nbsp; &nbsp; // --- enable and connect the PLL (Phase Locked Loop) ---<br />&nbsp; &nbsp; &nbsp; &nbsp; // a. set multiplier and divider<br />&nbsp; &nbsp; &nbsp; &nbsp; PLLCFG = MSEL | &#40;1&lt;&lt;PSEL1&#41; | &#40;0&lt;&lt;PSEL0&#41;;<br />&nbsp; &nbsp; &nbsp; &nbsp; // b. enable PLL<br />&nbsp; &nbsp; &nbsp; &nbsp; PLLCON = &#40;1&lt;&lt;PLLE&#41;;<br />&nbsp; &nbsp; &nbsp; &nbsp; // c. feed sequence<br />&nbsp; &nbsp; &nbsp; &nbsp; PLLFEED = PLL_FEED1;<br />&nbsp; &nbsp; &nbsp; &nbsp; PLLFEED = PLL_FEED2;<br />&nbsp; &nbsp; &nbsp; &nbsp; // d. wait for PLL lock (PLOCK bit is set if locked)<br />&nbsp; &nbsp; &nbsp; &nbsp; while &#40;!&#40;PLLSTAT &amp; &#40;1&lt;&lt;PLOCK&#41;&#41;&#41;;<br />&nbsp; &nbsp; &nbsp; &nbsp; // e. connect (and enable) PLL<br />&nbsp; &nbsp; &nbsp; &nbsp; PLLCON = &#40;1&lt;&lt;PLLE&#41; | &#40;1&lt;&lt;PLLC&#41;;<br />&nbsp; &nbsp; &nbsp; &nbsp; // f. feed sequence<br />&nbsp; &nbsp; &nbsp; &nbsp; PLLFEED = PLL_FEED1;<br />&nbsp; &nbsp; &nbsp; &nbsp; PLLFEED = PLL_FEED2;<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&#125;<br />&nbsp;steps to initialise pll  1.         // --- enable and connect the PLL (Phase Locked Loop) ---	// a. set multiplier and divider	PLLCFG = MSEL | (1&lt;&lt;PSEL1) | (0&lt;&lt;PSEL0);remember MSEL = M -1 cause to remove devide by zero error... the MSEL value is always +1 there will be other instances too... we will discuss as they come across..2.       // b. enable PLL	PLLCON = (1&lt;&lt;PLLE);every time you make a change in PLLCON register be sure to follow it up with a feed sequence to affect the changes done... else there wud be no effect  and old status will be in  effect...    so..        // c. feed sequence	PLLFEED = PLL_FEED1;	PLLFEED = PLL_FEED2;//mandatory3.       // d. wait for PLL lock (PLOCK bit is set if locked)	while (!(PLLSTAT &amp; (1&lt;&lt;PLOCK)));4.       // e. connect (and enable) PLL	PLLCON = (1&lt;&lt;PLLE) | (1&lt;&lt;PLLC);	// f. feed sequence	PLLFEED = PLL_FEED1;	PLLFEED = PLL_FEED2;  now your system is ready to work at the desired PLL frequencies...   remember PLL settings shud be carefully done... as they help generate the frequencies for almost all on chip devices...note: dont worry writing this function in your every code..  it will remain same as long as u use the same crystall...</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t4311.html">
						<title>Re: ARM tutorial :  UART</title>
						<link>http://www.8051projects.net/forum-t4311.html</link>
						<dc:date>2009-01-07T22:15:04-08:00</dc:date>
						<dc:creator>shyam</dc:creator>
						<dc:subject></dc:subject>
						<description>now since the pll has been set to operate at a frequency say 60Mhz...we can start using the inbuilt devices... the first one is UARTfirst of all let us initialise our uart to a desired baudrateBAUDRATE = PCLK /(   (16*(256*U0DLM+U0DLL))  (1+  (DivAddVal/MulVal))  )PCLK is the clock frequency generated from the PLL DLM &amp; DLL each are 8 bit registers required to divide the clock to desired frequency....   for further fine tuning of the baud rate we have DivAddVal      and   mulVal registers The UART0 Divisor Latch is part of the UART0 Fractional Baud Rate Generator and holdsthe value used to divide the clock supplied by the fractional prescaler in order to producethe baud rate clock, which must be 16x the desired baud rate (Equation 9–1). The U0DLLand U0DLM registers together form a 16 bit divisor where U0DLL contains the lower 8 bitsof the divisor and U0DLM contains the higher 8 bits of the divisor. A 0x0000 value istreated like a 0x0001 value as division by zero is not allowed assuming PCLK = 60Mhz  assuming no fine tuning required...for a baud rate of 115200 lets find out the values of DLL and DLM remember it will be easier if ou consider DLL and DLM a single 16 bit register instead of 2 8 bit register .. with the higher byte going to DLM=> (256*U0DLM+U0DLL) = 60,000,000/(16*115200) = 32.552 =>0x0020 hex=> DLM = 0x00      DLL = 0x20so we can calculate the values required for any baud rate!!!!try out to find the maximum baud rate you can generate in LPC214X (remember division by zero not possible in LPC214x ... the zero in final expression(denominator) will automatically be taken as +1).consider the following funtion void init_uart0(void)u will find a new register U0LCR  refer manual u will find  => bit7               DLAB bit6              Set Break   bit5              StickParity   bit4               EvenPar.Selct.   bit3               ParityEnable   bit2               No. ofStop Bits   bit1   bit0      Word Length Select           for 8 bit no parity 1 stop bit... from manualbit0 =1bit1 =1bit 2 =0bit 3=0bit 7  (dlab) =1=> U0LCR =0x83     or   U0LCR =0x80 ; U0LCR=0x03;The Divisor Latch Access Bit (DLAB) in U0LCR must be zero in order to access theU0THR(transmit hold register)/U0RBR (receive buffer register)   and must be one when updating values of DLL DLM....so we have...CODE:<br />void init_uart0&#40;void&#41;<br />&#123;<br />U0LCR = 0; &nbsp; &nbsp; &nbsp;// DLAB = 0<br />U0LCR = 0x80; &nbsp; // DLAB = 1<br />U0DLM = 0x00; &nbsp; // DLM = 0x00<br />U0DLL = 0x20; &nbsp; // DLL = 0x20, Divisor = 32, set baudrate=115200<br />U0LCR = 0x03; &nbsp; // DLAB = 0, No parity, 8 data, 1 stop<br />&#125;<br />int putchar &#40;int ch&#41; /* Write character to Serial Port */<br />&#123;<br />if &#40;ch == '\n'&#41;<br />&nbsp; &nbsp; &nbsp;&#123;<br />&nbsp; &nbsp; &nbsp; &nbsp;while &#40;!&#40;U0LSR &amp; 0x20&#41;&#41;;<br />&nbsp; &nbsp; &nbsp; U0THR = CR; /* output CR */<br />&nbsp; &nbsp; &nbsp; &#125;<br />while &#40;!&#40;U0LSR &amp; 0x20&#41;&#41;;<br />return &#40;U0THR = ch&#41;;<br />&#125;<br />int getchar &#40;void&#41; /* Read character from Serial Port */<br />&#123;<br />while &#40;!&#40;U0LSR &amp; 0x01&#41;&#41;;<br />return &#40;U0RBR&#41;;<br />&#125;we will next discuss the above code!! till then bye    for users referring to user manual for lpc214x series please note:PLL in all above  discussion shall be veiwed as PLL0  similarly all registers will changeex PLLCFG =>PLL0CFGPLLCON =>PLL0CONthe second PLL will be discussed under the topic USB!! till then no mention of PLL1 registers  also the name of registers may change according to the header files used ex. most lpc210x.h headers will have SCB_PLLCFG instead of PLLCFG. please  post your doubts (UART) here....http://www.8051projects.net/forum-t4322-last.html</description>
						</item>
				</rdf:RDF>