Proton BASIC Compiler - 16-bit devices: Pins and PPS

  • PicŪ Basic

  • 16-bit devices: Peripheral Functons, Pins and PPS

    This is a short description of how to match pins and peripheral functions and how to determine which values to use.
    The need for this came up when charliecoultas asked a question about ICSP. Furthermore I wanted to understand myself...

    Now there are of course the PPS macro's and all symbols declared for you, but sometimes you just want to know how Les came up with RPOR7 = 3 in the manual.

    The datasheet I used is that of the 24HJ128GP502.

    We want to send data through UART1.
    First select a pin for the function you want.
    e.g. pin 25. That's RB14
    Note the RP number for this pin.
    pin25 > RP14

    Select the value for the funcion UART1 Transmit from table 11-2.
    That is U1TX.
    Look at table 4-20 and find out which RPOR is associated with RP14.
    That's RPOR7.
    U1TX has a value of 3

    Result: RPOR7 = 3.

    Suppose we also need to receive.
    Since we selected UART1 in the previous example, it makes sense to use this here too.
    We want to use pin 24.
    Pin: 24, RB13, that's RP13.
    Table 11-1 shows us that Uart1 Receive is Register RPINR18, the configuration bits U1RXR<4:0>
    Look up the Register RPINR18.
    Now what value do you need, it is not explained in detail.
    Just my interpretation: for RP25 the value to be used is 25, for RP0 the value is 0.
    Does that make sense? It does to me.

    Result: U1RXR = 13

    That's all for now