...
SPI1 – DMA and SPI2 - GPS
Code Block | ||
---|---|---|
| ||
//Set interrupts IFS0bits.SPI1IF = 0; IEC0bits.SPI1IE = 1; IPC2bits.SPI1IP = 4; SPI1BUF = 0; //SPI clock controlled by this module SPI1CON1bits.DISSCK = 0; //Output pins are controlled by this module SPI1CON1bits.DISSDO = 0; //16/8 bit communication mode (1/0) SPI1CON1bits.MODE16 = 1; //16 //Master mode(1)/Slave mode(0) SPI1CON1bits.MSTEN = 0; //Slave //Enable Slave Select SPI1CON1bits.SSEN = 0; //Sample Phase (end/middle) SPI1CON1bits.SMP = 0; //Sample the input at the middle of the square wave //Clock Edge Select SPI1CON1bits.CKE = 0; //Output data changes from idle state to active clock state (1 is the opposite) //Clock Polarity SPI1CON1bits.CKP = 0; //Idle clock state is low, active clock state is high //Enable SPI SPI1STATbits.SPIEN = 1; |
...