InitPortC: ;PORTC is a multifaceted port supporting I/O for several ; onboard peripherals. ; bit pin name ; --- --- --- ; 0 11 RC0/T1OSC/T1CKI Timer1 I/O ; 1 12 RC1/T1OSI/CCP2 Timer1,Capture/Compare I/O ; 2 13 RC2/CCP1 Capture/Compare/PWM I/O ; 3 14 RC3/SCK/SCL SPI/i2c I/O ; 4 15 RC4/SDI/SDA SPI/i2c I/O ; 5 16 RC5/SDO SPI I/O ; 6 17 RC6/TX/CK O USART ; 7 18 RC7/RX/DT I USART ; ; * I'm using these pins ; 0 = output ; I = input ; T = tristate input/output ; clrf PORTC page1 movlw B'10111001' ; 0=outputs ; ||| | ; ||| | ; ||| | ; ||| | ; ||| +-------------SCL I2C clock --->: ; ||+-------SDO (Serial Data Out) ; || ; || ; || ; |+-----------------UART TX --->: ; +---------------UART RX <:--- movwf TRISC page0 return
Listing 5—Here’s a good example of how the PIC spins the pins.