SPI

//—– SETUP SPI 1 —– //Used for: Flash memory IC w_temp = SPI1BUF; SPI1STAT = 0; SPI1CON1 = 0x0320; //SPI in master mode //Data is valid on the rising edge of the clock (Transmit occurs on transition from active to idle clock state) //Clock low in idle bus state SPI1CON1bits.PPRE1 = 1; //Prescallers 4:1 1:1 […]

Read More

I2C

//—– SETUP I2C 1 —– //Used for: temperature sensor I2C1CONbits.I2CEN = 0; I2C1BRG = 93; //400kHz @ 40MHz Fcy I2C1CONbits.I2CEN = 1;

Read More