View previous topic :: View next topic |
Author |
Message |
Guest
|
PIC16F877 |
Posted: Sun Nov 19, 2006 8:53 am |
|
|
I currently using my SPI for an external ADC. Is is still possible to store my data in an MMC card using the other pins? Or do i really need to use the SPI? If i really need to use the SPI for the MMC, is it possible to use the external ADC w/o using the SPI? Thanks in advance. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Sun Nov 19, 2006 9:29 am |
|
|
SPI protocol doesn´t have addressing capabilities.
Normal use of this protocol is enabling (addressing) the target device with a dedicated line.
You can use both devices sharing the same SPI lines, selecting its corresponding Chip Select.
Humberto |
|
|
Guest
|
|
Posted: Sun Nov 19, 2006 8:46 pm |
|
|
If i use the same i/o lines for SPI (mmc & adc) are there any changes to the hardware i will have to implement? Thanks for reply. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Mon Nov 20, 2006 6:05 am |
|
|
We doesn´t know your hardware.
You would need to wire the SPI lines SI, CK & SO (if necessary) + Chip Select
to every device sharing the SPI bus.
This means that the system must have a separate Select line to
"address" the target device.
Humberto |
|
|
Guest
|
|
Posted: Thu Nov 23, 2006 12:35 am |
|
|
If my ADC requires SPI_MODE_0_0 while my MMC requires SPI_MASTER wouldnt that create conflicts? |
|
|
Guest
|
|
Posted: Thu Nov 23, 2006 12:41 am |
|
|
If my ADC requires SPI_MODE_0_0 while my MMC requires SPI_H_TO_L and the spi clock periods are diff wouldnt that create conflicts?
Code: |
//ADC
setup_spi(SPI_MASTER | SPI_MODE_0_0 | SPI_CLK_DIV_16);
//MMC
SETUP_SPI(SPI_MASTER | SPI_H_TO_L | SPI_CLK_DIV_4 | SPI_SS_DISABLED);
|
|
|
|
|