Need help with my code

Discussion in 'Programmer's Corner' started by alkid, Oct 1, 2007.

  1. alkid

    Thread Starter Member

    Sep 20, 2007
    12
    0
    Hi
    i wrote the MISO-MISO, SCK-SCK, MOSI-MOSI but now is that how i assigned the rest of the pins for CE, CSN and IRQ of the nRF24L01
    #include "C8051F120.h"
    // Peripheral specific initialization functions,
    // Called from the Init_Device() function
    void SPI_Init()
    {
    SFRPAGE = SPI0_PAGE;
    SPI0CFG = 0x40;
    SPI0CN = 0x01;
    }

    void Port_IO_Init()
    {
    // P0.0 - SCK (SPI0), Open Drain,Digital
    // P0.1 - MISO (SPI0), Open Drain,Digital
    // P0.2 - MOSI (SPI0), Open-Drain,Digital
    // P0.3 - NSS (SPI0), Open-Drain,Digital
    // P0.4 - Unassigned, Open-Drain,Digital
    // P0.5 - Unassigned, Open-Drain,Digital
    // P0.6 - Unassigned, Open-Drain,Digital
    // P0.7 - Unassigned, Open-Drain,Digital

    // P1.0 - Unassigned, Open-Drain,Digital
    // P1.1 - Unassigned, Open-Drain,Digital
    // P1.2 - Unassigned, Open-Drain,Digital
    // P1.3 - Unassigned, Open-Drain,Digital
    // P1.4 - Unassigned, Open-Drain,Digital
    // P1.5 - Unassigned, Open-Drain,Digital
    // P1.6 - Unassigned, Open-Drain,Digital
    // P1.7 - Unassigned, Open-Drain,Digital

    // P2.0 - Unassigned, Open-Drain,Digital
    // P2.1 - Unassigned, Open-Drain,Digital
    // P2.2 - Unassigned, Open-Drain,Digital
    // P2.3 - Unassigned, Open-Drain,Digital
    // P2.4 - Unassigned, Open-Drain,Digital
    // P2.5 - Unassigned, Open-Drain,Digital
    // P2.6 - Unassigned, Open-Drain,Digital
    // P2.7 - Unassigned, Open-Drain,Digital

    // P3.0 - Unassigned, Open-Drain,Digital
    // P3.1 - Unassigned, Open-Drain,Digital
    // P3.2 - Unassigned, Open-Drain,Digital
    // P3.3 - Unassigned, Open-Drain,Digital
    // P3.4 - Unassigned, Open-Drain,Digital
    // P3.5 - Unassigned, Open-Drain,Digital
    // P3.6 - Unassigned, Open-Drain,Digital
    // P3.7 - Unassigned, Open-Drain,Digital

    SFRPAGE = CONFIG_PAGE;
    XBR0 = 0x02;
    XBR2 = 0x40;
    }

    void Interrupts_Init()
    {
    EIE1 = 0x01;
    }

    // Initialization function for device,
    // Call Init_Device() from your main program
    void Init_Device(void)
    {
    SPI_Init();
    Port_IO_Init();
    Interrupts_Init();
    }
    Put aside the source code i prepared to solder the SCK, MISO, MOSI, CSN as i found out that using any port pin then the IRQ is connected to so which mean i need set the pin for int0. Just to confirm? Tks in advance.
     
Loading...