CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Internal Op-Amp Not Working [Solved]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mictel



Joined: 24 May 2014
Posts: 14

View user's profile Send private message

Internal Op-Amp Not Working [Solved]
PostPosted: Fri Jun 27, 2014 8:26 pm     Reply with quote

I'm trying to use the internal Op-Amps in the 16F1789 for the first time. I configured them as follows:
Code:

   setup_opamp1(OPAMP_ENABLED);
   setup_opamp1(OPAMP_HIGH_GBWP_MODE);
   setup_opamp1(OPAMP_I_TO_OUTPUT);

I have the Op-Amp configured as a voltage follower (inverting input connected to the output and applying the signal to the non-inverting input) but the Op-Amp is not reproducing the signal applied to the non-inverting input at its output. The input signal applied is a 0 to 5V saw tooth wave (2.5V offset) at 1kHz; the output remains at ground; with a slight ripple.

Additional configuration information:

I am addressing I/O ports as memory using the #byte directive with variable names using fast_io
Code:
#use fast_io(a)            // Fast IO for port a

This requires you set the port direction register using the Tris command:
Code:
  set_tris_a(0b00110010);

The pins associated with the Op-Amp are specified as inputs (1) and not assigned to any variable with the #Byte command:
Code:

#byte lat_a = getenv("SFR:LATA")

// port a #defines
#bit Spare1 = lat_a.0        // Spare Pin Assigned as output for debugging
// a1                                   OpAmp1 Output; Vr
#bit Disp1 = lat_a.2         // Display LED 1 output; Active Low
#bit Spare2 = lat_a.3        // Spare Pin Assigned as output for debugging
// a4                                   OpAmp1 + input; Vcap
// a5                                   OpAmp1 - input; Vr
#bit Disp5 = lat_a.6         // Display LED 5 output; Active Low
#bit Disp4 = lat_a.7         // Display LED 4 output; Active Low

Perhaps using fast I/O with an Op-Amp configuration is the problem. Would appreciate help to figure out why the Op-Amps are not working properly from those with experience working with the internal Op-Amps.
Thanks.
mictel



Joined: 24 May 2014
Posts: 14

View user's profile Send private message

Problem Solved
PostPosted: Fri Jun 27, 2014 10:20 pm     Reply with quote

After some experimentation and quality time with the data sheet...

The format of Op-Amp setup is:

setup_opamp1(OPAMP_ENABLED|OPAMP_HIGH_GBWP_MODE);

Note that the option to connect the inverting input to the op-amp output (OPAMP_I_TO_OUTPUT) is in the 16F1789.h header file but no such option exists on the data sheet, subsequently, it does not work. A physical connection must be made between the inverting input pin and the output pin to create a voltage follower.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group