```spice * Enhanced PGA PSPICE Model .SUBCKT PGA IN+ IN- CTRL OUT+ OUT- VDD VSS * Parameters .PARAM TEMP_NOM = 27 ; Nominal temperature in celsius .PARAM VOS = 2E-3 ; Input offset voltage .PARAM CMRR = 10000 ; Common Mode Rejection Ratio .PARAM PSRR = 30000 ; Power Supply Rejection Ratio .PARAM SR = 10E6 ; Slew Rate (V/s) .PARAM GBW = 7E6 ; Gain-Bandwidth product .PARAM VNOISE = 100E-9 ; Input voltage noise density (V/√Hz) * Input Stage with Common Mode Rejection * Common mode voltage calculation E_CM CM 0 VALUE = {(V(IN+) + V(IN-))/2} * Differential input with offset and CMRR E_IN INDIFF 0 VALUE = {V(IN+,IN-) + VOS + V(CM)/CMRR} * Power Supply Rejection E_PSR PSR 0 VALUE = {(V(VDD) - V(VSS))/PSRR} * Gain Control Stage .PARAM GAIN = { + IF(V(CTRL) < 1, 1, + IF(V(CTRL) < 2, 2, + IF(V(CTRL) < 3, 4, + IF(V(CTRL) < 4, 8, + IF(V(CTRL) < 5, 16, + IF(V(CTRL) < 6, 32, + IF(V(CTRL) < 7, 64, + 20))))} * Frequency Response and Slew Rate Limiting * First order frequency response EFREQ FR 0 INDIFF 0 LAPLACE = {GAIN/(1+s/(2*PI*GBW/GAIN))} * Slew Rate Limiting ESR SR 0 FR 0 SLEW = SR * Temperature Effects .PARAM TEMP_COEFF = 0E-6 ; Temperature coefficient (V/°C) E_TEMP TEMP 0 VALUE = {(TEMP-TEMP_NOM)*TEMP_COEFF*V(SR)} * Noise Sources * Voltage noise VN1 NOISE1 0 AC 1 RN1 NOISE1 0 1 HN1 VNOISE 0 VN1 0 {VNOISE} * Output Stage * Combine all effects E_OUT OUT_INT 0 VALUE = {V(SR) + V(TEMP) + V(PSR) + V(VNOISE)} * Output voltage limitations E_LIMIT OUT+ OUT- VALUE = { + MIN(MAX(V(OUT_INT), V(VSS) + 0.1), + V(VDD) - 0.1)} * Output current limiting .PARAM IMAX = 220uA ; Maximum output current G_OUT OUT+ OUT- VALUE = { + MIN(MAX(I(E_LIMIT), -IMAX), IMAX)} * Input Protection D1 IN+ VDD DIODE D2 VSS IN+ DIODE D3 IN- VDD DIODE D4 VSS IN- DIODE * Input impedance RIN1 IN+ 0 10MEG CIN1 IN+ 0 1pF RIN2 IN- 0 10MEG CIN2 IN- 0 1pF * Output impedance ROUT OUT+ OUT- 76m COUT OUT+ OUT- 10pF * Power Supply Pins RPD VDD 0 100K RPS VSS 0 100K * Model for protection diodes .MODEL DIODE D (IS=1E-14 RS=0.1) .ENDS PGA