Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Need help with my code

Status
Not open for further replies.

alkid

Junior Member level 1
Joined
Sep 24, 2007
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,464
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. :)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top