CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

No SPI clocks PIC16F18424

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
JerryR



Joined: 07 Feb 2008
Posts: 190

View user's profile Send private message

No SPI clocks PIC16F18424
PostPosted: Mon Mar 09, 2026 11:04 am     Reply with quote

Can anyone tell me why this code does not generate clocks on SPI1? No clocks confirmed with logic analyser and o-scope.

PCWH v5.121 uC- 16F18424

Thanks!



Code:

#include <16F18424.h>


#use delay(clock=32000000) // 8 MHz internal osc
#fuses RSTOSC_HFINTRC_32MHZ

#use spi(MASTER, BITS=8, MODE=0, BAUD=100000)


#pin_select SCK1 = PIN_C0
#pin_select SDI1 = PIN_C1

//=============================================================================
void main ()
{
int8 value1,value2;


while (1)
    {
    value1= spi_xfer (0);
    value2= spi_xfer (0);
    }
}
gaugeguy



Joined: 05 Apr 2011
Posts: 358

View user's profile Send private message

PostPosted: Mon Mar 09, 2026 12:00 pm     Reply with quote

General comments:
Put the pin_select before # use spi and add SPI1 into #use spi to force it to use the hardware.
JerryR



Joined: 07 Feb 2008
Posts: 190

View user's profile Send private message

PostPosted: Mon Mar 09, 2026 12:30 pm     Reply with quote

Thanks so much for your consideration. Generating clocks now.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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