CrazyEngineers
  • 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/..
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • a.alandkar

    MemberMar 7, 2014

    using this command you are defining that pin as a i/p pin.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register