PIC SPI Connection.

Thread Starter

R!f@@

Joined Apr 2, 2009
9,918
PIC.png
Above is pin out of the pic in question.
1. The SPI connection are RC3, RC4, and RC5 ? Right ?
2. I have read the RA5 (SS) - slave select pin can be any digital IO ? Is it true ?
3. If I were to use 3 SPI slaves, I have to use additional 3 digital IO's (say..RC0,RC1 & RC2) as chip select pins. Right ?
4. The Pins in Q1 above is same for all 3 SPI slaves. while the chip selects are unique to each Slave..Right ?
5. RC7 & RC6 re not used in SPI but for serial data like serial port in a computer. Right ?
 

OBW0549

Joined Mar 2, 2015
3,566
1. The SPI connection are RC3, RC4, and RC5 ? Right ?
Right.
2. I have read the RA5 (SS) - slave select pin can be any digital IO ? Is it true ?
Right, provided you've configured the SPI for master operation; if you've configured it so that the PIC is an SPI slave, the SS- pin functions as the chip select input.
3. If I were to use 3 SPI slaves, I have to use additional 3 digital IO's (say..RC0,RC1 & RC2) as chip select pins. Right ?
Right.
4. The Pins in Q1 above is same for all 3 SPI slaves. while the chip selects are unique to each Slave..Right ?
Right.
5. RC7 & RC6 re not used in SPI but for serial data like serial port in a computer. Right ?
Right.
 

Thread Starter

R!f@@

Joined Apr 2, 2009
9,918
Aaah ! I was wondering about SS pin.
It must be used if PIC is in slave mode. That explains a lot.
As I said before, I am planning to buy those SPI ADC's, So PIC will be the Master.
Thanks all.

One more q ?
joeyd999 said I could use the TX pin to drive the buzzer. So I am going to experiment on it.
Question is if I use TX (RC6) pin to drive the buzzer with the baud rate I select, can I use the RX (RC7) as a normal digital IO.
Or will the RX pin be configured along with TX pin and cannot be used for any other purpose ?
 

AlbertHall

Joined Jun 4, 2014
12,346
One more q ?
joeyd999 said I could use the TX pin to drive the buzzer. So I am going to experiment on it.
Question is if I use TX (RC6) pin to drive the buzzer with the baud rate I select, can I use the RX (RC7) as a normal digital IO.
Or will the RX pin be configured along with TX pin and cannot be used for any other purpose ?
No you can't - from the datasheet:
upload_2016-9-12_12-43-27.png
 

OBW0549

Joined Mar 2, 2015
3,566
joeyd999 said I could use the TX pin to drive the buzzer. So I am going to experiment on it.
Yes, you can do that. In most of my PIC projects I've used the UART as a diagnostic interface, with TXD and RXD connected to a header for an FTDI cable. Very handy for reporting status, computation results, etc. during execution. In some projects, I've also used it to control operations during factory calibration & test.
Question is if I use TX (RC6) pin to drive the buzzer with the baud rate I select, can I use the RX (RC7) as a normal digital IO.
Or will the RX pin be configured along with TX pin and cannot be used for any other purpose ?
It can still be used as a digital input, but not as an output.
 

Thread Starter

R!f@@

Joined Apr 2, 2009
9,918
In short, if TX pin can be used as TX, the RX pin will be a Digital Input ONLY.
Can it be used as a Switch input for other purposes ? Not like RX data ?
 

OBW0549

Joined Mar 2, 2015
3,566
In short, if TX pin can be used as TX, the RX pin will be a Digital Input ONLY.
Can it be used as a Switch input for other purposes ? Not like RX data ?
Sure. It can serve as a digital input for whatever purpose you want. Of course, anything happening on that pin will eventually drive the UART receiver section batsh*t crazy with tons of framing errors, FIFO overruns, and whatever, but AFAIK this doesn't affect the transmitter half of the UART in any way. DO consult the data sheet to make sure, though.
 
Top