This is a small example that works perfectly normal when compiled with PICC-18 STD v9.52, but it does not work when compiled with PICC-18 PRO v9.80!?
PIC18F25K20 @ 4MHz write data to CC1101 register
#include <htc.h>
void SPI_TR_Done(char data)
{
SSPBUF = data;
while(!SSPIF);
SSPIF = 0; // Reset SSPIF flag
}
void SPI_Write(char adr, char data)
{
RC2=0; // chip select
while (SDI);
SPI_TR_Done(adr);
SPI_TR_Done(data);
RC2=1;
}
void main(void)
{
char x;
CM1CON0 = 0;
CM2CON0 = 0;
ANSEL = 0;
ANSELH = 0;
ADCON0 = 0;
ADCON1 = 0;
RBPU = 0;
PORTA = PORTB = PORTC = 0;
TRISC = 0b10010001;
// spi init
SSPSTAT = 0b11000000;//
SSPCON1 = 0b00100000;// SPI Master mode, Fosc/4,0 = Idle state for clock
// spi test, write
while(1){
SPI_Write(0, 77);
x = SPI_Read(0); // in PRO ver. return 0 (zero)
if (x == 77) break;
}
}
Does anyone know what the problem is with the PRO version of the compiler?
Changed optimization has no effect, operation mode (Lite / Pro) has no effect ...