P Santhosh Kumar
Member • Feb 28, 2014
Having queries in ARM-SPI programming, plz clarify ?
Hai CEians,
i am having doubt in ARM Programming given below:
// SPI master initating function
//link: www.electroons.com
void MASTER_INIT(unsigned int spi_number)
{
PINSEL0 = (PINSEL0 & ~(3 << 12)) | (1 << 12); // MOSI0 SPI0
PINSEL0 = (PINSEL0 & ~(3 << 10)) | (1 << 10); // MISO0 SPI0
PINSEL0 = (PINSEL0 & ~(3 << 8)) | (1 << 8); // SCK0 SPI0
}
here i want to select SPI pins in PINSEL register, in LPC2148 ARM Processor, for ex. MOSI mean I have to make
"PINSEL0=1<<12;" is enough.
So, Why write the code like this:
PINSEL0 = (PINSEL0 & ~(3 << 12)) | (1 << 12); // MOSI0 SPI0
Is this the procedure to enable MOSI pin in SPI in LPC2148 processor?
Plz clarify it.
Any response is appreciated/..
i am having doubt in ARM Programming given below:
// SPI master initating function
//link: www.electroons.com
void MASTER_INIT(unsigned int spi_number)
{
PINSEL0 = (PINSEL0 & ~(3 << 12)) | (1 << 12); // MOSI0 SPI0
PINSEL0 = (PINSEL0 & ~(3 << 10)) | (1 << 10); // MISO0 SPI0
PINSEL0 = (PINSEL0 & ~(3 << 8)) | (1 << 8); // SCK0 SPI0
}
here i want to select SPI pins in PINSEL register, in LPC2148 ARM Processor, for ex. MOSI mean I have to make
"PINSEL0=1<<12;" is enough.
So, Why write the code like this:
PINSEL0 = (PINSEL0 & ~(3 << 12)) | (1 << 12); // MOSI0 SPI0
Is this the procedure to enable MOSI pin in SPI in LPC2148 processor?
Plz clarify it.
Any response is appreciated/..