Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Reading value of register

Reading value of register

2004-12-07 by Sridhar gadda

Hello I am using �vision3 and Arm7 lpc2129 for my application. I would like to display the value, which is read from register on my computer screen.

int init_spi_read(void) /* Data is being read from SPI, MISO */
{
char read;
read = S0SPDR;
while (!(S0SPSR & 0x08)); /* check for the SPIF bit */
return (S0SPSR); /* if Bit is High, read status register*/
printf("The data read from ADC is %c", read);
}

when compile no error but when I want to read value from hyperterminal com...it doesn't display.....where am I doing error ???

Thanks....

Sridhar. 


		
---------------------------------
Do you Yahoo!?
 The all-new My Yahoo! � Get yours free!    

[Non-text portions of this message have been removed]

Re: [lpc2000] Reading value of register

2004-12-07 by Robert Adsett

At 02:33 AM 12/7/04 -0800, you wrote:

<snip>
>int init_spi_read(void) /* Data is being read from SPI, MISO */
>{
>char read;
>read = S0SPDR;
>while (!(S0SPSR & 0x08)); /* check for the SPIF bit */
>return (S0SPSR); /* if Bit is High, read status register*/
>printf("The data read from ADC is %c", read);
>}
>
>when compile no error but when I want to read value from hyperterminal 
>com...it doesn't display.....where am I doing error ???

trying to print after the routine has already exited.  I would recommend 
using something like a good lint (PC-Lint is good) it will catch these 
types of errors. As will some compilers.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

RE: [lpc2000] Reading value of register

2004-12-07 by Paul Curtis

The %c is a particularly inappropriate conversion specifier for this.
The original poster could always try %d which will almost certainly get
better results. 

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, and (soon) Atmel AVR processors  
Show quoted textHide quoted text
> -----Original Message-----
> From: Robert Adsett [mailto:subscriptions@aeolusdevelopment.com] 
> Sent: 07 December 2004 13:51
> To: lpc2000@yahoogroups.com
> Subject: Re: [lpc2000] Reading value of register
> 
> 
> At 02:33 AM 12/7/04 -0800, you wrote:
> 
> <snip>
> >int init_spi_read(void) /* Data is being read from SPI, MISO 
> */ { char 
> >read; read = S0SPDR; while (!(S0SPSR & 0x08)); /* check for the SPIF 
> >bit */ return (S0SPSR); /* if Bit is High, read status register*/ 
> >printf("The data read from ADC is %c", read); }
> >
> >when compile no error but when I want to read value from 
> hyperterminal 
> >com...it doesn't display.....where am I doing error ???
> 
> trying to print after the routine has already exited.  I 
> would recommend using something like a good lint (PC-Lint is 
> good) it will catch these types of errors. As will some compilers.
> 
> Robert
> 
> " 'Freedom' has no meaning of itself.  There are always 
> restrictions, be they legal, genetic, or physical.  If you 
> don't believe me, try to chew a radio signal. "
> 
>                          Kelvin Throop, III
> 
> 
> 
> ------------------------ Yahoo! Groups Sponsor 
> --------------------~--> Make a clean sweep of pop-up ads. 
> Yahoo! Companion Toolbar.
> Now with Pop-Up Blocker. Get it for free!
> http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/dN_tlB/TM
> --------------------------------------------------------------
> ------~-> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.