Help with SPI communication on PIC16F877A.

Say "hi" here, and any general non PIC related chat.

Help with SPI communication on PIC16F877A.

Postby torjoltz » Tue May 13, 2025 10:11 pm

Hi everyone,
I'm a newbie working on a project involving SPI communication between a PIC16F877A microcontroller and an external sensor. I've been struggling to get the data transfer working correctly and I'm hoping someone with more experience can offer some guidance.
My current setup involves:
* PIC16F877A as the master
* External sensor as the slave
* SPI configured in master mode with a clock frequency of 1 MHz
* Using the MSSP module for SPI communication
My code is based on some examples I found online, but I'm not sure if I'm configuring the registers correctly. I'm also having trouble understanding how to properly handle the data transfer and ensure that the data is being received correctly.
Here are some specific questions I have:
* What are the key registers I need to configure for SPI communication on the PIC16F877A?
* How do I properly handle the SPI interrupt and ensure that the data is being received correctly?
* What are some common mistakes that can lead to SPI communication problems?
* Are there any good resources or tutorials that you would recommend for learning about SPI communication on PIC microcontrollers?
Any help or suggestions would be greatly appreciated! I'm really eager to learn and get this project working.
Thanks in advance!.
torjoltz
 
Posts: 1
Joined: Tue May 13, 2025 10:06 pm
Location: JP
PIC experience: EE Student

Re: Help with SPI communication on PIC16F877A.

Postby ric » Mon May 19, 2025 4:17 am

Without showing your code, it is really hard to guess what you may have done wrong.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 666
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products


Return to Introductions and general chat

Who is online

Users browsing this forum: No registered users and 8 guests