Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

[PIC] SPI communication is not happening with NRF24L01 transceiver in PIC16F18854

Status
Not open for further replies.

Arunkrrish

Newbie level 3
Joined
Jun 29, 2018
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
47
* I am trying to connect two pic16f18854 microcontroller. one as transmitter and one as receiver. In transmitter if i press switch means receiver side LED should blink. For communication i am using NRF24L01 Transceiver on both side using SPI communication.

* First i tried this project with pic16f877a microcontroller with the same logic i mentioned above. That is working correctly. I am using same NRF24L01 configuration to pic16f18854. But its not working. I configured all pic assignments through MCC generator.

* I will paste transmitter and receiver code for pic16f18854 as a zip file. Please check that and reply what's going wrong with my project. Thank you...

PIC16F18854 + NRF24L01 Transmitter Code

View attachment NRF24L01_PIC16f18854_Transmitter.zip

PIC16F18854 + NRF24L01 Receiver Code

View attachment NRF24L01_PIC16f18854_Receiver.zip
 

What do you mean by "...its not working"?
This type of error description of fairly useless. You need to tell us what you expected to occur that didn't. Also what happened that you didn't expect to occur.
Just looking at the Transmit zip file I see that you have only performed a 'release' build and not a 'debug' build. You should use the debugger to see what is happening in your code - it can tell you a lot.
If you say the PIC16F887A version works, then try using that as (say) the transmitter and see of the receiver code works. Also try the other way around. (In other words, make one change at a time to see if you can tell which change breaks things.)
Does the LED light when you push the button?
Looking at the transmit 'main' code I have a few comments:
- the switch debounce code you have is crude but is possible effective in this case. However I strongly urge you to improve this area of your code - as soon as you get to a more advanced bit of code then this approach may well cause you problems
- You light the LED for 100mSec which is very short and almost at the limit of what the human eye can detect (something around 60-70mSec). In this case, and to get things tested, try lighting the LED for about 1 second
- there is a subtle logical problem in the main loop: you detect when the switch pulls RB7 to ground and trigger your actions. However the total period of the loop is approximately 210mSec (with the button pressed) and it is quite likely that the program will loop around several times while you have your finger on the button. This means that your LED will flash several times and you will also be sending out the message several times. It would be better to detect the push, send the message and then detect the button begin released.
There are many other comments that can be made about your code but there are more fundamental issues (as mentioned above) to fix right now.
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top