SPI in PIC16F877 in slave mode MikroBasic

Post your requests and ideas on the future development of mikroBasic.
Post Reply
Author
Message
angelbuenamigo
Posts: 1
Joined: 09 Sep 2010 18:40

SPI in PIC16F877 in slave mode MikroBasic

#1 Post by angelbuenamigo » 09 Sep 2010 19:11

Hi every body,
I cant communicate two pic16f877 throu SPI.
I've made the hw connections I dont think there's a problem there.
But I would like to ask for someone If can give me some code example
for programming the SPI in slave mode,

I know that the SPI should be initialize this way

Code: Select all

     SPI1_Init_Advanced(_SPI_SLAVE_SS_ENABLE,
                         _SPI_DATA_SAMPLE_MIDDLE, 
                         _SPI_CLK_IDLE_LOW, 
                         _SPI_LOW_2_HIGH)
For the slave

and for the master:

Code: Select all

     SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4,
                         _SPI_DATA_SAMPLE_MIDDLE,
                         _SPI_CLK_IDLE_LOW,
                         _SPI_LOW_2_HIGH) ' Inicia SPI
But i dont know, please someone send some code.
I've made the program for a PIC as master and device MCP4921
just like the Mikro Examples.
And everythings goes ok!
But now, the slave mode is totally diferent I think


Please help!
:|
Attachments
Proyecto PIC-PIC SPI.rar
Here is my master code and slave code, I also attached the Desing in Proteus 7.6
(102.62 KiB) Downloaded 517 times

User avatar
ranko.rankovic
Posts: 433
Joined: 11 Jun 2010 09:22

Re: SPI in PIC16F877 in slave mode MikroBasic

#2 Post by ranko.rankovic » 14 Sep 2010 21:32

Hello angelbuenamigo,

Look at this topic, I know this is mikroC, but it may lead you to solution.

Best regards
Ranko Rankovic
mikroElektronika [Support Department]

Post Reply

Return to “mikroBasic Wish List”