How to disable SPI peripheral

General discussion on mikroBasic.
Post Reply
Author
Message
k.ifantidis
Posts: 15
Joined: 23 Nov 2012 23:17

How to disable SPI peripheral

#1 Post by k.ifantidis » 11 May 2015 15:09

Hello, i would like to ask if anyone knows how to disable the SPI peripheral after i have enabled it with SPI2_Init_Advanced() command. I used 18F26K22 pic microcontroller at 64Mhz.
My problem is that i want to sent 3bits SPI cascaded and then use the spi module to sent the 8bit data. But if there will be need to send 3bits again and i use the SDO/SCKLpins, it simply doesn't work. So i though that i have to disable/enable the SPI module.

Regards, Kostas.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: How to disable SPI peripheral

#2 Post by janni » 11 May 2015 16:09

You could zero the SSP2EN bit in SSP2CON1 register (see Chapter 15 of the processor datasheet).

k.ifantidis
Posts: 15
Joined: 23 Nov 2012 23:17

Re: How to disable SPI peripheral

#3 Post by k.ifantidis » 14 May 2015 07:25

Hello, thank you for your reply my friend. I thought about it but i can't believe that it will be that easy :p IT is NEVER that easy haha. The think is that i want to use the SPI ports as outputs after closing the SPI and if turn off all the registers associated with SPI library i don't think this can happen. I solved this by creating my own software SPI lib.
Regards, Kostas.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: How to disable SPI peripheral

#4 Post by janni » 14 May 2015 11:53

k.ifantidis wrote: I solved this by creating my own software SPI lib.
Own library is always the best solution :) .

Post Reply

Return to “mikroBasic General”