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.
Did you setup the serial communication. Take a look to the example in the folder Keil\ARM\Boards\Keil\MCB2100\Blinky. The module SERIAL.C is required for initialization.
I did the serial initialization as shown in example serial.c of Blinky. In gerenal How can I display value read from register. please help me. regards,
Does Blinky display values in the Hyperterminal window?
No it didn't display value. I set everything correct and checked twice. The hyperterinal window says commminicating, I waited for a long but no dispay. with regards, Sridhar
Are you using the COM1 connector? Do you have an oscilloscope to measure the communication stream?
yes I am using COM1. when I download hexfile of blinky, LEDs blink. but when I want to read through hyperterminal ..i do not see result. I dont have oscilloscope to test. Where am I doing wrong. If I were doing wrong then LEDs should not blink....I hope I am right. regards,
If your printf is after a return statement then how will it ever be reached?
Thaks I correct it now in my program. but why Blinky example is not display result on hyperterminal.
Maybe you should not return from the function before calling printf?
int init_spi_read(void) /* Data is being read from SPI, MISO */ { char read; read = S0SPDR; while (!(S0SPSR & 0x08)); /* check for the SPIF bit */ read = S0SPSR; /* if Bit is High, read status register*/ printf("The data read from ADC is %c", read); return(read); }