Re: SPI Clock: Easy Setup Does Not Match Measured. Why?
2018/11/24 17:28:50
(permalink)
New symptoms: I was able to program two 16F18855 chips, one as master and one as slave. The slave read the SPI connection and correctly turned an LED on and off. The master monitored a switch and sent that info to the slave for operating the LED, and it all worked. However, when I try to change settings in SPI Easy Setup, nothing changes. The clock remains "idle low, active high," and the rate remains at 250KHz.
void main(void)
{
SYSTEM_Initialize();
while (1)
{
PORTCbits.RC2 = 0;//select slave
if(PORTAbits.RA5 == 1) {//get push button value
PORTAbits.RA0 = 0;//if pushed turn on the LED
//PORTCbits.RC2 = 0;//select slave
SPI1_Exchange8bit(255);//send the byte 0xFF
__delay_ms(1);//wait for 1 millisecond to avoid spamming the slave
} else {
PORTAbits.RA0 = 1;//if not pushed turn off the LED
//PORTCbits.RC2 = 0;//select slave
SPI1_Exchange8bit(0);//send the byte 0x00
__delay_ms(1);//wait for 1 millisecond to avoid spamming the slave
}
PORTCbits.RC2 = 1;//deselect slave
}
}