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/..
Replies
-
a.alandkarusing this command you are defining that pin as a i/p pin.
You are reading an archived discussion.
Related Posts
Google has announced the integration of voice-assist feature to its latest Beta version 34. Until now Chrome users had to use Google's Voice Search Hotword extension to enable the same...
Google has released a major update for Hangouts on iOS. The Hangouts version 2.0 has got a full redesign matching the iOS 7's flat-UI style. The update was announced by...
The time has come to say goodbye to touch screens and sensing technologies. Yes, controlling smartphones via gestures can soon become a reality and we can do away with sensing...
Regional smartphone manufacturer WickedLeak has put up its new smartphone, the Wammy Passion X for sale on its official online store for Rs. 19,990. The Wammy Passion X tries to...
I know I know, RPi went on sale on 29th of Feb 2012. But since 2014 ain't leap year, we will celebrate it today!
Happy birthday Raspberry Pi! All thanks...