• AVR Freaks

Hot!Input pins for OPA module in PIC16F1703

Author
leadinglights
Super Member
  • Total Posts : 392
  • Reward points : 0
  • Joined: 2003/11/07 12:41:48
  • Status: offline
2019/04/07 09:51:05 (permalink)
0

Input pins for OPA module in PIC16F1703

 
In the PIC16F1703 can both the inverting and non-inverting inputs of the OPA module be assigned for general use when the module is configured as a unity gain buffer for an internal fixed voltage reference?

Detail, taken from document DS40001722C

In FIGURE 17-1 the inverting input can be selected to give unity gain by OPAxUG bit in OPAxCON and the OPAxIN- pin is relinquished. This is explicitly stated in 17.1.2 copied below.

From the same figure, the FVR_Buffer2 can be selected for the non-inverting input of the OPA module by the OPAxNCH bits. In this case however, there is no explicit statement that the OPAxIN+ pin is relinquished for digital IO.

My apologies for being pedantic but it will be several days before I have some PIC16F1703 microcontrollers to try and need to get the PCB files out to be made before I will recieve them.

17.1.2 UNITY GAIN MODE
The OPAxUG bit of the OPAxCON register selects the
Unity Gain mode. When unity gain is selected, the OPA
output is connected to the inverting input and the
OPAxIN pin is relinquished, releasing the pin for
general purpose input and output.
 
Additional pedantic note, I think that OPAxIN should be shown as the inverting input with a negative postscript OPAxIN-

Thanks for any assistance you can give.

Mike


#1

3 Replies Related Threads

    pcbbc
    Super Member
    • Total Posts : 926
    • Reward points : 0
    • Joined: 2014/03/27 07:04:41
    • Location: 0
    • Status: offline
    Re: Input pins for OPA module in PIC16F1703 2019/04/07 14:50:42 (permalink)
    +1 (1)
    11.3.1 DIRECTION CONTROL
    The TRISB register (Register 11-10) controls the PORTB pin output drivers, even when they are being used as analog inputs. The user should ensure the bits in the TRISB register are maintained set when using them as analog inputs. I/O pins configured as analog inputs always read ‘0’.

    11.3.6 PORTB FUNCTIONS AND OUTPUT PRIORITIES
    Each pin defaults to the PORT latch data after reset. Other functions are selected with the peripheral pin select logic. See Section 12.0 “Peripheral Pin Select (PPS) Module” for more information. Analog input functions, such as ADC and Op Amp inputs, are not shown in the peripheral pin select lists. These inputs are active when the I/O pin is set for Analog mode using the ANSELB register. Digital output functions may continue to control the pin when it is in Analog mode.

    Similarly PORTC.


    My reading of that is to use the analogue functions of a pin (of which OPA is one), you must also enable the corresponding bit in ANSELB. If you do not, the pin still functions as a digital pin, direction as defined by the TRISB bit as normal.

    So:
    ANSEL=0: Digital I/O. Pin is assigned to port or digital special function.
    TRISB=1 digital input, TRISB=0 digital output
    In this case what you have programmed in OPAxCON is esentially irrelevant to the functioning of the IO pin, but don’t expect the OPA module to work correctly if you are selecting an external pin as input (edit: internal sources such as FVR_Buffer2 should work fine).

    ANSEL=1: Analog input. Pin is assigned as analog input(1). Digital input buffer disabled.
    TRISB should be 1
    In this case OPAxCON can be used to select the required pin as input to the OPA module.

    But that is just my reading of the datasheet. I confess I don’t have any experience of this chip or the OPA modules.
    post edited by pcbbc - 2019/04/07 14:57:04
    #2
    Mysil
    Super Member
    • Total Posts : 3323
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: online
    Re: Input pins for OPA module in PIC16F1703 2019/04/07 15:53:03 (permalink)
    +1 (1)
    Hi,
    In the PIC16F1703 can both the inverting and non-inverting inputs of the OPA module be assigned for general use when the module is configured as a unity gain buffer for an internal fixed voltage reference?

    Answer is Yes.
     
    The Analog multiplexers that select inputs to Operation Amplifier,
    are just like  Analog multiplexers for other purposes, like AD  Converter inputs.
    When a Pin is Not selected for Analog Input, then it is free for other use, digital or analog.
    This is regardless of whether the Pin could be used for analog input to OPA, analog Comparator or ADC.
     
        Mysil
    #3
    leadinglights
    Super Member
    • Total Posts : 392
    • Reward points : 0
    • Joined: 2003/11/07 12:41:48
    • Status: offline
    Re: Input pins for OPA module in PIC16F1703 2019/04/08 01:38:28 (permalink)
    0
    Thank you Mysil & pcbbc. I have now sent the PCB to be made.
     
    Mike
    #4
    Jump to:
    © 2019 APG vNext Commercial Version 4.5