View previous topic :: View next topic |
Author |
Message |
Christophe
Joined: 10 May 2005 Posts: 323 Location: Belgium
|
what happens with this pin? |
Posted: Tue May 24, 2005 4:00 am |
|
|
Hi,
review this piece of code:
Code: | #define BR_STROBE PIN_C4
main()
{
output_low(BR_SLEEP);
setup_spi (SPI_MASTER|SPI_L_TO_H|SPI_XMIT_L_TO_H|SPI_CLK_DIV_4);
...
} |
What has happened with pin C4 ( = SDI of the SPI peripheral). I want to use it as an spi-independant I/O. -or I only want to use the master interface of the SPI.
edit:
How can you disable the SPI in CCS-C ? |
|
|
valemike Guest
|
|
Posted: Tue May 24, 2005 5:22 am |
|
|
Assuming RC4 is part of the SPI MSSP module, then your setup_spi module will override any tris settings you have for the tris bits.
You'll have to choose another pin for io. |
|
|
Christophe
Joined: 10 May 2005 Posts: 323 Location: Belgium
|
|
Posted: Tue May 24, 2005 6:11 am |
|
|
what if I switch those statements?
Code: | setup_spi (SPI_MASTER|SPI_L_TO_H|SPI_XMIT_L_TO_H|SPI_CLK_DIV_4);
output_low(BR_SLEEP); |
|
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue May 24, 2005 6:20 am |
|
|
What if you read the datasheet for the PIC? |
|
|
Christophe
Joined: 10 May 2005 Posts: 323 Location: Belgium
|
|
Posted: Tue May 24, 2005 8:04 am |
|
|
Quote: | Any serial port function that is not desired may be
overridden by programming the corresponding data
direction (TRIS) register to the opposite value. |
I'm sorry that I was for any inconvenience for you, Mark |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue May 24, 2005 11:09 am |
|
|
Didn't inconvenience me I was just helping you to help yourself. |
|
|
|