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] PIC16F887 SPI interfacing with MCP3550.

Status
Not open for further replies.

ismbn

Full Member level 3
Joined
Feb 11, 2012
Messages
160
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,308
Location
Mumbai. india
Activity points
2,444
Hello All.

i am now for PIC microcontroller. I tried allot but the SPI is not working.
my aplication is take the data form MCP3550. and show on 4 digit 7 segment.
i am just getting the problem in communication between PIC16F887 and MCP3550.
please guide me how to make alive the communication between them.
this is the simple code the i an trying to read the data and show it on PORTD.
Please help me....
load scell help.png

Code:
#include <pic.h>
void my_delay(char x)
{
char q,w;
for (q=0;q < 255; q++)
for(w=0;w<x;w++);
}
char x;
void main()
{
TRISC = 0b10010111;;
TRISA = 0x01;
TRISD=0;

	SSPSTAT |= 0b10000000;
	SSPCON	|= 0b00100100;
while(1){
	my_delay(10);
x  = SSPBUF;
PORTD = x;
}
}
am i correct????
 

I am guessing one the registers haven't been setup for the correct SPI communication.

From the datasheet, "When using the SSP module in SPI slave mode and SS enabled, the A/D converter must be set to one of the followed modes, where PCFG3:pCFG0 = 0100,0101,1110,1111." It appears you are in slave mode so this could be the issue.

"SS must have TRISA<5> set and register ADCON1 must be set in a way that pin RA5 is configured as a digital I/O"
 

@cl10greg ,Thank you so much for the replay Sir.
the datasheet seem to very difficult to read an understand. Sir can you please show me how to configure it.
i want uC in Master mode. the ADC Controlling by SS bit.
Thanks Once again.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top