|
|
View previous topic :: View next topic |
Author |
Message |
GusA
Joined: 28 Mar 2020 Posts: 5 Location: York, PA
|
SPI mode change |
Posted: Tue Mar 30, 2021 1:43 pm |
|
|
I am working with a PIC18F67K22 microcontroller, using the PCWH compiler ver 5.093.
I have a working SPI bus configured as follows:
#use spi (MASTER, SPI1, BAUD=500000, MODE=0, BITS=8, STREAM=SPI_1)
The bus is operational with all spi devices except for one that requires the MODE=1 (IDLE=0 and SAMPLE_FALL). I have not found a library function that can change modes within the program (when communicating with the particular device).
Is there any way, besides using assembly (#asm.....#endasm)?
Thanks! |
|
|
GusA
Joined: 28 Mar 2020 Posts: 5 Location: York, PA
|
|
Posted: Tue Mar 30, 2021 2:29 pm |
|
|
CCS technical support replied as follows, which BTW I tried and worked fine:
You can do this:
#use spi (MASTER, SPI1, BAUD=100000, MODE=0, BITS=8, STREAM=SPI_1A) #use spi (MASTER, SPI1, BAUD=100000, MODE=1, BITS=8, STREAM=SPI_1B)
Call spi_init() to change the mode and always use the right stream ID for the SPI calls. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Tue Mar 30, 2021 11:31 pm |
|
|
Yes, this has been answered here before. Using two (or more) streams. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|