Connecting multiple SPI slaves to the same PIC 30f6014

General discussion on mikroC for dsPIC30/33 and PIC24.
Post Reply
Author
Message
vkatona
Posts: 4
Joined: 06 Oct 2011 23:26

Connecting multiple SPI slaves to the same PIC 30f6014

#1 Post by vkatona » 06 Oct 2011 23:35

Hi,
I would like to connect multiple SPI slave device to the 30f6014 PIC. By using the dspC how can I address these multiple SPI devices? What pin should I use for the SS addressing? Is it any definition for the “Chip Select” (“SS”) by the SPI function?
Thanks,
Victor

tariq7868
Posts: 5
Joined: 26 Sep 2011 21:05

Re: Connecting multiple SPI slaves to the same PIC 30f6014

#2 Post by tariq7868 » 07 Oct 2011 16:44

As in SPI, each slave has a pin (Slave Select / Chip Select) which is directly connected to Master (without being shared with any other slave). and usually SDI , SDO & SCK pins are all shared & connected to all slaves. So in order to address any of the slave, Master simply uses corresponding slave select pin (Active Low logic) to activate/alert the slave for data transfer. if you are using PIC microcontroller with a builtin SPI module, then there is a SS pin available to be used for SPI as slave. And for using as a master in SPI, you can ignore the SS pin and can use any of the IO pin to dedicate for slave select.

ddp
Posts: 5
Joined: 09 Oct 2011 09:59
Location: Midrand, South Africa
Contact:

Re: Connecting multiple SPI slaves to the same PIC 30f6014

#3 Post by ddp » 09 Oct 2011 16:29

Hi vkatona

The SPI libraries do not take any chip-select arguments - you should specify and control the chip-selects manually in your code. This way you can address any number of SPI devices by setting the relevant chip-select(s). You can use any normal digital I/O pins for controlling the chip-selects.

You might find the example at the bottom of the page in the compiler SPI Library help-file topic helpful.

Cheers
Dane
www.dizzy.co.za (Southern African MikroElektronika Distributor)

vkatona
Posts: 4
Joined: 06 Oct 2011 23:26

Re: Connecting multiple SPI slaves to the same PIC 30f6014

#4 Post by vkatona » 10 Oct 2011 22:33

Hi Dane,

Thanks for the guidance on this. After I made more research I got same conclusion too.

Best regards,

Victor

Post Reply

Return to “mikroC for dsPIC30/33 and PIC24 General”