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 :


 

Attachments

  • master.rar
    568 bytes · Views: 115
  • slave.rar
    575 bytes · Views: 96



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: 110
  • master.rar
    17 KB · Views: 105
  • ISIS2.rar
    34.6 KB · Views: 101
Last edited:



finally it works :-D thank you so much Jestin_cubetech
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…