GunkutAThis is how I made the connections between my PIC and DAC( see the image attached).
You forgot to attach anything.
Do I need to map my pins as inputs also?
Input pins are different from output pins. See:
17.1 PPS Inputs
17.2 PPS Outputs
17.3 Bidirectional Pins
PPS selections for peripherals with bidirectional signals on a single pin must be made so that the PPS input and PPS output select the same pin.
RC7PPS= 0b00011111 ; //DIN, RC7 = SDIPPS
//Pin RC7 is configured as output SPI1 (SDO)
RC6PPS= 0b00100000; //CS, RC6= SSPPS
//Pin RC6 is configured as output SPI1 (SS)
RC5PPS= 0b00011110; //SCLK, RC5=SCKPPS
//Pin RC5 is configured as output SPI1 (SCK)
So I believe this is enough for setting them as output. Do I also need to set them as inputs? If yes how do I do that? I think I need to use xxxPPS register (Page:265) by using table 17-1 (Page:266). But I don't know how to use it. Do I do something like this:
No, inputs are defined by the following registers:
SPI1 Clock SPI1SCKPPS
SPI1 Data SPI1SDIPPS
SPI1 Slave Select SPI1SSPPS
The values you need to set for these registers are given in 17.8 Register Definitions: PPS Input Selectionbit 7-6 Unimplemented: Read as ‘0’
bit 5-3 xxxPPS<5:3>: Peripheral xxx Input PORTx Pin Selection bits
101 = Reserved
100 = Reserved
011 = Reserved
010 = PORTC
001 = PORTB
000 = PORTAbit 2-0xxxPPS<2:0>: Peripheral xxx Input PORTx Pin Selection bits
111 = Peripheral input is from PORTx Pin 7 (Rx7)
110 = Peripheral input is from PORTx Pin 6 (Rx6)
101 = Peripheral input is from PORTx Pin 5 (Rx5)
100 = Peripheral input is from PORTx Pin 4 (Rx4)
011 = Peripheral input is from PORTx Pin 3 (Rx3)
010 = Peripheral input is from PORTx Pin 2 (Rx2)
001 = Peripheral input is from PORTx Pin 1 (Rx1)
000 = Peripheral input is from PORTx Pin 0 (Rx0)
Inputs and outputs are configured differently. You need to remember any one pin can only be mapped to a single OUTPUT function (or you'd have a conflict). But one pin can drive multiple input singnals, no problem at all.
Therefore: outputs are mapped by pin via RxxPPS
And: inputs are mapped by function via pinfuncPPS register