Coolquest, Inc. | Home | Products | Support | About | Contact | |||
|
Design Home | << File View >> | Class View | Output (partial) | Parts Library | Examples Home |
// THIS FILE IS IN THE PUBLIC DOMAIN. // IT IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT // NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. #ifndef _LV_ComparatorH_ #define _LV_ComparatorH_ #include "ad1580.h" // Low-Voltage comparator // The user sets the overvoltage threshold by changing the value of RAdjust via a call to SetTypeName(). // RAdjust's value is RAdjust = Rh/( Vthresh/Vref - 1 ) where: // Rh = 10.2 kohm // Vref = 1.225/2 V (.6125V) // Vthresh = user's desired threshold voltage--must be greater than Vref. // See LV_ComparatorResistorValues.xls for a table of RAdjust values. class CM_LV_Comparator : public TModule { public: port VCC; // 3.3V supply port GND; port IN; port OUT; // 3.3V if IN > threshold, 0V if IN < threshold CP_AD1580 Reference; // 1.225V voltage reference CP_R4_7K Rb; // bias resistor for reference CP_R10_2KP1 Rrefh; // Rrefh and Rrefl divide reference voltage by two CP_R10_2KP1 Rrefl; CP_R10_2KP1 Rh; // half of resistor divider, tied to IN CP_RCHIP805 RAdjust; // other half of resistor divider (also known as Rl) -- user must specify actual value using SetTypeName() CP_AD8517ART Amp; // low-voltage rail-to-rail op-amp public: virtual void Register() { reg( VCC ); reg( GND ); reg( IN ); reg( OUT ); reg( Reference ); reg( Rb ); reg( Rrefh ); reg( Rrefl ); reg( Rh ); reg( RAdjust ); reg( Amp ); } virtual void Connect() { VCC << Amp.VPP; // power GND << Amp.VNN << Reference.VNN; OUT << Amp.OUT; "/NC" << Reference.NC; "V_REF" << Reference.VPP ^ Rb ^ VCC; // reference is biased by Rb "V_REF" ^ Rrefh ^ "IN_N" << Amp.IN_N ^ Rrefl ^ GND; // V_REF/2 goes to Amp - input IN ^ Rh ^ "IN_P" << Amp.IN_P ^ RAdjust ^ GND; // divided IN goes to Amp + input } }; #endif
Design Home | << File View >> | Class View | Output (partial) | Parts Library | Examples Home |
Legal | Copyright © 2007 by Coolquest, Inc. | Contact |