<?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>2008-12-02T00:08:18-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-t9121.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t9121.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t9121.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t9121.html" />
				</rdf:Seq>
				</items>
				</channel>
						<item rdf:about="http://www.8051projects.net/forum-t9121.html">
						<title>code help needed for my lazy friend</title>
						<link>http://www.8051projects.net/forum-t9121.html</link>
						<dc:date>2008-12-02T00:08:18-08:00</dc:date>
						<dc:creator></dc:creator>
						<dc:subject></dc:subject>
						<description>hi bros,i have a very lazy friend.he has been given a project ( to complete in class) which is based on ARM.Now the problem is that he has copied a project from internet,but he dont know what the code is doing actually..or what code can do.now its my headache to help him...but i dont know much about ARM.Can anyone help me understanding that code?? so that i can help him.   Code: CODE:<br />//=====================================================================<br />// Sean Finn, FYP 2006<br />// Embedded C control program for the ARM microcroller used<br />// &nbsp; &nbsp; &nbsp; &nbsp;as core of the ETU<br />//<br />//---------------------------------------------------------------------<br />// Operation:<br />// Samples EKG &amp; stethoscope signals (attached to ADC channels 0 &amp; 1,<br />// &nbsp; &nbsp; &nbsp; &nbsp;respectively), at 2.5 kHz &amp; 500 Hz &nbsp; &nbsp; &nbsp;(respectively).<br />// These 12 bit samples are then sent, a nibble at a time, to<br />// &nbsp; &nbsp; &nbsp; &nbsp;Server PC thorough UART at 115200 baud (no parity, 2 stop bits)<br />//=====================================================================<br /><br />#include &lt;ADuC7024.h> &nbsp;//include definitions specific to eval board used<br /><br />// function prototypes: definintions in seperate source file<br />extern int write &#40;int file, char * ptr, int len&#41;; &nbsp; &nbsp;// outputs a string on UART (for debug) &nbsp; &nbsp; <br />extern int put_byte&#40;int&#41;; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // outputs a byte via UART <br />extern void send_pak&#40;unsigned char* buffer, int buff_size&#41;; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//sends the entrire Tx buffer<br />extern void initialise&#40;void&#41;; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// performs ARM initialisation (peripherals etc)<br />extern void IRQ_func&#40;void&#41;; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// ADC interrupt servive routine<br /><br />//global variables<br /><br />// variables associated with ADC conversions<br />unsigned short xn = 0;<br />unsigned short xn2 =0;<br />unsigned short samp_ctr = 0;<br />unsigned short pak_ctr = 0;<br />unsigned short dwnsmpl_ctr = 0;<br />static unsigned short dwnsmpl_ratio = 5; // 500 Hz EKG sampling frequency<br /><br />// buffer variables<br />unsigned int buffer_size = 6012;<br />unsigned char send_buff1&#91;6012&#93; = &#123;0&#125;; &nbsp; &nbsp; // circular transmitt buffer<br />unsigned char buffer_full = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // buffer full flag<br />unsigned char buff_send_margin = 99; &nbsp; &nbsp; // send margin, to avoid buffer overrun (must be multiple of 3)<br />unsigned char* UART_ptr; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// pointer to address the transmit buffer<br /><br />//filtering variables, redundant here (see note below)<br />// filter co-efficients<br />//unsigned short co_efs&#091;21] = {46637,49888,52926,55711,58208,60382,62202,63644,64689,<br />// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;65322,65535,65322,64689,63644,62202,60382,58208,55711,52926,<br />// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;49888,46637}; &nbsp;//20th order LPF &nbsp; <br />//static unsigned char FILT_ORD = 20; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //order of the digital LPF implemented<br />//unsigned short mem&#091;20] = {0}; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //filters memory elements, of size FILT_ORD<br />//unsigned short filtered_smpl;<br /><br />int main &#40;void&#41; &nbsp;&#123;<br />&nbsp; &nbsp; //char output1&#091;13] = "Hello World!\n"; &nbsp; &nbsp; &nbsp;// debugging UART test<br /><br />&nbsp; &nbsp; // pefore ADC is enabled, set up buffer, point pointer to first element of buffer array<br />&nbsp; &nbsp; UART_ptr = &amp;send_buff1&#91;0&#93;;<br /><br />&nbsp; &nbsp; initialise&#40;&#41;; &nbsp; &nbsp;//initialise peripherals: UART, ADC, etc<br /><br />&nbsp; &nbsp; // Set up the IRQ<br />&nbsp; &nbsp; FIQ = IRQ_func; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // &nbsp; &nbsp;Specify (Fast) Interrupt Service Rountine<br />&nbsp; &nbsp; FIQEN = 0x8; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// enable timer 1 IRQ mask<br />&nbsp; &nbsp; GP4DAT ^= 0x00040000; &nbsp; &nbsp; &nbsp; &nbsp;// Complement P4.2 (LED), to indicate program is started<br /><br />&nbsp; &nbsp; // Main functionality handled by ADC ISR<br />&nbsp; &nbsp; // Infinite loop, poll for full buffer flag, calling send_pak function when detected<br />&nbsp; &nbsp; while&#40;1&#41;<br />&nbsp; &nbsp; &#123; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; if&#40; buffer_full == 1&#41; &#123; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GP4DAT ^= 0x00040000; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Complement P4.2 (LED)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; send_pak&#40;UART_ptr, buffer_size&#41;; &nbsp; &nbsp;// send the packet<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UART_ptr = &amp;send_buff1&#91;0&#93;; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// reset send pointer<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; buffer_full = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // reset eand flag<br />&nbsp; &nbsp; &nbsp; &nbsp; &#125;<br />&nbsp; &nbsp; &#125;<br />&#125;<br /><br />//=============ADC interrupt servive routine=========================<br />// Medodology: Timer 1 triggers a conversions at 2.5 kHz, and a<br />// &nbsp; &nbsp;sthethoscope &nbsp;sample is read &amp; stored in buffer.<br />// &nbsp;Upon every 5th such conversion (ie at 500 Hz), a software<br />// &nbsp; &nbsp;triggeredconversion of EKG channel is performed.<br />//<br />// &nbsp; &nbsp;In prevoius versions, both were sampled at higher rate, and the<br />// &nbsp; &nbsp;EKG was low pass filtered, and then downsampled. In this version<br />// &nbsp;filtering code is commented (no downsampling => no filtering required).<br />//====================================================================<br /><br /><br />void IRQ_func&#40;void&#41; &#123;<br />&nbsp; &nbsp; //unsigned short j; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// local counter declaration (filtering)<br />&nbsp; &nbsp; GP1DAT ^= 0x00800000; &nbsp; &nbsp; &nbsp; &nbsp;// Complement P1.7 &nbsp; &nbsp; (debug - ADC freq probing)<br />&nbsp; &nbsp; &nbsp; &nbsp;T1CLRI = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// clear timer 1 interrupt flag<br />&nbsp; &nbsp; xn = &#40;ADCDAT >> 16&#41; &amp; 0xFFF; &nbsp; &nbsp; &nbsp; &nbsp;// read ADC sample<br />&nbsp; &nbsp;<br />&nbsp; &nbsp; // nibble by nibble sample stroage. MS nibble of each byte is a counter,<br />&nbsp; &nbsp; // used for decoding data stream at PC server &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; //store steth sample in byte-wide buffer: MSNibble, MiddleNibble LSNibble<br />&nbsp; &nbsp; send_buff1&#91;samp_ctr&#93; = 0x40 | &#40;xn >> 8&#41;;<br />&nbsp; &nbsp; samp_ctr++;<br />&nbsp; &nbsp; send_buff1&#91;samp_ctr&#93; = 0x20 | &nbsp;&#40;&#40;xn >> 4&#41; &amp; 0xF&#41;;<br />&nbsp; &nbsp; samp_ctr++;<br />&nbsp; &nbsp; send_buff1&#91;samp_ctr&#93; = 0x10 | &#40;xn &amp; 0xF&#41;;<br />&nbsp; &nbsp; samp_ctr++;<br /><br />&nbsp; &nbsp; if&#40;dwnsmpl_ctr == dwnsmpl_ratio -1&#41; &#123; // every 5th sample<br />&nbsp; &nbsp; &nbsp; &nbsp; GP1DAT ^= 0x00010000; &nbsp; &nbsp; &nbsp; &nbsp;// Complement P1.0 &nbsp; &nbsp;(debug - ADC freq probing) &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; //perform a signle sofware driven ADC conversion from chan 1<br />&nbsp; &nbsp; &nbsp; &nbsp; ADCCP = 0x01; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//switch ADC channel<br />&nbsp; &nbsp; &nbsp; &nbsp; ADCCON = 0xE3; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// config for a software conversion &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; while &#40;!ADCSTA&#41;&#123;&#125; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// wait for end of conversion<br />&nbsp; &nbsp; &nbsp; &nbsp; xn = &#40;ADCDAT >> 16&#41;; &nbsp; &nbsp; &nbsp; &nbsp;// read ADC sample<br />&nbsp; &nbsp; &nbsp; &nbsp; ADCCP = 0x07; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// select steth channel (1) again<br />&nbsp; &nbsp; &nbsp; &nbsp; ADCCON=0xE1; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//return ADC config to timer 1 driven conversions<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; // Digital filtering, now redundant.<br />&nbsp; &nbsp; &nbsp; &nbsp; //--------EKG sample now read, perform filtering------------//<br />&nbsp; &nbsp; &nbsp; &nbsp; //filtered_smpl = co_efs&#091;0]*xn;<br />&nbsp; &nbsp; &nbsp; &nbsp; //for(j=1;j&lt;FILT_ORD;j++) {<br />&nbsp; &nbsp; &nbsp; &nbsp; // &nbsp; &nbsp;filtered_smpl += co_efs&#091;j]*mem&#091;j-1];<br />&nbsp; &nbsp; &nbsp; &nbsp; //}<br />&nbsp; &nbsp; &nbsp; &nbsp; //update memory elements<br />&nbsp; &nbsp; &nbsp; &nbsp; //for(j=FILT_ORD;j>0;j--){<br />&nbsp; &nbsp; &nbsp; &nbsp; // &nbsp; &nbsp;mem&#091;j] = mem&#091;j-1];<br />&nbsp; &nbsp; &nbsp; &nbsp; //}<br />&nbsp; &nbsp; &nbsp; &nbsp; //mem&#091;0] = xn;<br />&nbsp; &nbsp; &nbsp; &nbsp; //------Digital Filtering Complete-----------------------//<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; //store the sample, samp method as for steth samples<br />&nbsp; &nbsp; &nbsp; &nbsp; xn = &#40;ADCDAT >> 16&#41;&amp; 0xFFF;<br />&nbsp; &nbsp; &nbsp; &nbsp; send_buff1&#91;samp_ctr&#93; = 0xC0 | &#40;xn >> 8&#41;;<br />&nbsp; &nbsp; &nbsp; &nbsp; samp_ctr++;<br />&nbsp; &nbsp; &nbsp; &nbsp; send_buff1&#91;samp_ctr&#93; = 0xB0 | &nbsp;&#40;&#40;xn >> 4&#41; &amp; 0xF&#41;;<br />&nbsp; &nbsp; &nbsp; &nbsp; samp_ctr++;<br />&nbsp; &nbsp; &nbsp; &nbsp; send_buff1&#91;samp_ctr&#93; = 0xA0 | &#40;xn &amp; 0xF&#41;;<br />&nbsp; &nbsp; &nbsp; &nbsp; samp_ctr++;<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; dwnsmpl_ctr = 0; &nbsp; &nbsp; &nbsp; &nbsp;//reset counter<br />&nbsp; &nbsp; &#125; else &#123;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dwnsmpl_ctr++; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//increment counter<br />&nbsp; &nbsp; &#125;<br /><br />&nbsp; &nbsp; // watch for buffer almost full<br />&nbsp; &nbsp; if &#40;samp_ctr == buffer_size - buff_send_margin&#41; &#123;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;buffer_full = 1; &nbsp; &nbsp;// set the buffer full flag, main() will begin transmission<br />&nbsp; &nbsp; &#125; else if &#40;samp_ctr == buffer_size&#41; &#123; //at the end of buffer, start filling from start again<br />&nbsp; &nbsp; &nbsp; &nbsp; samp_ctr = 0; &nbsp; &nbsp; &nbsp; &nbsp;//reset sample counter<br />&nbsp; &nbsp; &nbsp; &nbsp; pak_ctr++;<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &#125;<br />&#125;<br />//=====================================================================<br />// Final Year Project ARM functions<br />// Sean Finn, 2006<br />//=====================================================================<br />#include &lt;aduc7024.H> &nbsp; &nbsp; &nbsp;//include definitions specific to eval board used &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /><br />#define CR &nbsp; &nbsp; 0x0D &nbsp; &nbsp; &nbsp;//define ASCII code for carrige return, for string Tx<br /><br />// standard delay routine<br />void delay&#40;int length&#41;<br />&#123;<br />&nbsp; &nbsp; while &#40;length >=0&#41;<br />&nbsp; &nbsp; &nbsp; &nbsp; length--;<br />&#125;<br /><br />// outputs a byte via UART<br />int put_byte&#40;unsigned int ch&#41; &nbsp;&#123; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /><br />&nbsp; &nbsp; if &#40;ch == '\n'&#41; &nbsp;&#123; &nbsp; &nbsp; &nbsp; // handle sending of newline<br />&nbsp; &nbsp; &nbsp; &nbsp; while&#40;!&#40;0x020==&#40;COMSTA0 &amp; 0x020&#41;&#41;&#41; &nbsp; &nbsp;//wait for UART not busy<br />&nbsp; &nbsp; &nbsp; &nbsp; &#123;&#125;<br />&nbsp; &nbsp; &nbsp; &nbsp; COMTX = CR; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &#125;<br />&nbsp; &nbsp; while&#40;!&#40;0x020==&#40;COMSTA0 &amp; 0x020&#41;&#41;&#41; &nbsp; &nbsp; &nbsp; &nbsp;//wait for UART not busy<br />&nbsp; &nbsp; &#123;&#125;<br /><br />&nbsp; &nbsp; return &#40;COMTX = ch&#41;;<br />&#125;<br /><br />//sends the entrire Tx buffer<br />void send_pak&#40;unsigned char* buffer, int buff_size&#41;<br />&#123;<br />&nbsp; &nbsp; &nbsp; &nbsp; unsigned int i;<br />&nbsp; &nbsp; &nbsp; &nbsp; delay&#40;1000&#41;;<br />&nbsp; &nbsp; &nbsp; &nbsp; for&#40;i=0;i&lt;buff_size;i++&#41; &#123; &nbsp; &nbsp;// loop through Tx buffer<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; put_byte&#40;*&#40;buffer+i&#41;&#41;; &nbsp; &nbsp;// send current byte using pointer arithmetic<br />&nbsp; &nbsp; &nbsp; &nbsp; &#125;<br />&#125;<br /><br />// outputs a string on UART (for debug)<br />int write &#40;int file, char * ptr, int len&#41; &#123;<br />&nbsp; int i;<br /><br />&nbsp; for &#40;i = 0; i &lt; len; i++&#41; put_byte &#40;*ptr++&#41;;<br />&nbsp; return len;<br />&#125;<br /><br />// performs ARM initialisation (peripherals etc)<br />void initialise&#40;void&#41; &#123;<br />&nbsp; &nbsp;<br />&nbsp; &nbsp; // UART configuration for 115200 baud<br />&nbsp; &nbsp; GP1CON = 0x011; &nbsp; &nbsp; &nbsp; &nbsp;// Setup tx &amp; rx pins on P1.0 and P1.1<br />&nbsp; &nbsp; COMCON0 = 0x80; &nbsp; &nbsp; &nbsp; &nbsp;// Setting DLAB<br />&nbsp; &nbsp; &nbsp; &nbsp;COMDIV0 = 0x0C; &nbsp; &nbsp; &nbsp; &nbsp;// Setting DIV0 and DIV1 to DL calculated<br />&nbsp; &nbsp; &nbsp; &nbsp;COMDIV1 = 0x00;<br />&nbsp; &nbsp; &nbsp; &nbsp;COMCON0 = 0x07; &nbsp; &nbsp; &nbsp; &nbsp;// Clearing DLAB<br />&nbsp; &nbsp; COMDIV2 = 0x884F;<br /><br />&nbsp; &nbsp; //ADC configuration<br />&nbsp; &nbsp; ADCCON=0x20; &nbsp; &nbsp;//power-on the ADC<br />&nbsp; &nbsp; delay&#40;80000&#41;; &nbsp; &nbsp;//wait for ADC poweron time<br />&nbsp; &nbsp; ADCCP=0x00; &nbsp; &nbsp; &nbsp; &nbsp;//Select ADC channel 0 by default<br />&nbsp; &nbsp; ADCCON=0xE1; &nbsp; &nbsp;//single-ended, start conversion on timer1<br />&nbsp; &nbsp; REFCON=0x01; &nbsp; &nbsp;//connect internal 2.5V reference to VREFpin<br /><br />&nbsp; &nbsp; // timer1 configuration &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; T1LD = 0x467; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Counter Value (for 2.5 kHz)<br />&nbsp; &nbsp; T1CON = 0xC4; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Enabled,Periodic,Binary<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; // IO ports initialisation<br />&nbsp; &nbsp; GP1DAT = 0xFF000000; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; GP3DAT = 0xFFFF0000;<br />&nbsp; &nbsp; GP4DAT = 0x04000000; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// P4.2 configured as an output. LED is turned on <br />&#125;<br />&nbsp;</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t9121.html">
						<title>Re: code help needed for my lazy friend</title>
						<link>http://www.8051projects.net/forum-t9121.html</link>
						<dc:date>2008-12-02T00:08:18-08:00</dc:date>
						<dc:creator>abbas1707</dc:creator>
						<dc:subject></dc:subject>
						<description>shyam bhai,can you help me regarding this ?:(</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t9121.html">
						<title>Re: code help needed for my lazy friend</title>
						<link>http://www.8051projects.net/forum-t9121.html</link>
						<dc:date>2008-12-02T00:08:18-08:00</dc:date>
						<dc:creator>shyam</dc:creator>
						<dc:subject></dc:subject>
						<description>hi abbas hope i am not late    Samples EKG &amp; stethoscope signals (attached to ADC channels 0 &amp; 1,        respectively), at 2.5 kHz &amp; 500 Hz      (respectively). These 12 bit samples are then sent, a nibble at a time, to        Server PC thorough UART at 115200 baud (no parity, 2 stop bits)lets see how the code works..lets first collect what devices we shall be requiring1. 2 ADC channels2. 1 UART port (Tx Rx)3. Timer to set the interrupt (to read the adc)4. GPIOs to connect LEDs (to show the response /result)we have to initialise all these devices first..void initialise(void)the above function does it..  the comments are self axplainatory.. still we can discuss each of the statements.the main  part is to scan the two ADC pins for data..ARM has several interrupt sources one of them is IRQ the other is FIQdont really know y ur frnd used FIQ here..   still FIQ is faster than IRQ.so we need to  write an IRQ ISRvoid IRQ_func(void) {the above function does it. The ISR collects the adc values and stores it in a buffer send_buff1now the stored data is needed to send thru UART and the leds needed to be controlledso in main()step1.  call the initialisationstep2. point the FIQ to the fun PTR of your ISRstep3. enable the interrupt source  i.e timer in FIQ modestep4. start an never ending loop  to transmit collected data and toggle the respective pins.actually been busy these few days so cud not reply on time</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t9121.html">
						<title>Re: code help needed for my lazy friend</title>
						<link>http://www.8051projects.net/forum-t9121.html</link>
						<dc:date>2008-12-02T00:08:18-08:00</dc:date>
						<dc:creator>abbas1707</dc:creator>
						<dc:subject></dc:subject>
						<description>Thanks a ton bhai</description>
						</item>
				</rdf:RDF>