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.

SPI code C with pic16f887

Status
Not open for further replies.

hanendaly

Newbie level 3
Joined
Apr 14, 2013
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,299
hello
i want to send a data (a simple value ) from pic 16f887 to another pic 16f887
this code doesn't give me any result when i do the verification with ISIS
after calling the spi write function the value of the data displaying in the LEDs it is not the value wanted and the result in the slave pic is not the data that i have send it :-x
would you please help me
thnx

there is the code master and slave and the isis verification :


ISIS_verification.PNG
 

Attachments

  • master.rar
    568 bytes · Views: 114
  • slave.rar
    575 bytes · Views: 95

82_1343724142.png


Master
Code:
////////////////////////////////////////////
unsigned int spi_write_hw(unsigned char val)
 {
    unsigned char ctrl;
    SS=0;
    SSPBUF=val;    while(!SSPIF);
    while(!BF);    ctrl=SSPBUF;
    SS=1;
    return ctrl; 
 }


slave
Code:
//////////////////////////////////
  void interrupt isr()
{
  if(SSPIF)
 {
   SSPIF=0;
   rcv=SSPBUF;  
   SSPBUF=snd;
 }
}

https://www.edaboard.com/threads/261292/
 

Attachments

  • slave.rar
    16.8 KB · Views: 109
  • master.rar
    17 KB · Views: 104
  • ISIS2.rar
    34.6 KB · Views: 100
Last edited:

82_1343724142.png


Master
Code:
////////////////////////////////////////////
unsigned int spi_write_hw(unsigned char val)
 {
    unsigned char ctrl;
    SS=0;
    SSPBUF=val;    while(!SSPIF);
    while(!BF);    ctrl=SSPBUF;
    SS=1;
    return ctrl; 
 }


slave
Code:
//////////////////////////////////
  void interrupt isr()
{
  if(SSPIF)
 {
   SSPIF=0;
   rcv=SSPBUF;  
   SSPBUF=snd;
 }
}

https://www.edaboard.com/threads/261292/


finally it works :-D thank you so much Jestin_cubetech :) :)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top