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

 
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: 168

View user's profile Send private message

No SPI clocks
PostPosted: Tue Jul 15, 2025 9:58 am     Reply with quote

Hi Group, thanks for your help on this-

I am using PCWH v5.093 to compile code for a PIC18F86J60. I am posting a small snippet of code below. I am using the hardware SPI1 to talk to two external SPI devices

The problem is that using either of the use_spi setups, results in no clocks being issue when attempting to write to a SPI device. The Data Out looks reasonable, however, but no clock pulses.

If I comment out both spi_setup statements, I can generate clock pulses on the clock pin (PIN_C3), so there's nothing in the hardware blocking the clock pin.

This is probably something very simple, but I just can't see it. Here's the code:

Code:

#include <18F86J60.h>
#device ADC=10

#FUSES NOWDT                    //No Watch Dog Timer

#use delay(crystal=25000000)

#use spi (MASTER, DI=PIN_C4, DO= PIN_C5, CLK= PIN_C3, BITS=8, MODE=0)
//#use spi (MASTER, SPI1, BITS=8, MODE=0)



void main()
{
   setup_adc_ports(AN0_TO_AN1, VSS_VDD);
   setup_adc(ADC_CLOCK_INTERNAL | ADC_TAD_MUL_0);
   
   output_high(PIN_A3);
   
    output_low(PIN_A3);
    delay_us(10);
    spi_write (0x50);
    spi_write(0x00);                           
    spi_write(0xFF);
    delay_us(10);
    output_high(PIN_A3);

   while(TRUE)
   {

   }

}
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