Reading opamp output from a GPIO

Thread Starter

chris43j

Joined Apr 13, 2017
1
This is probably just some very basic concept I am missing but it driving me up the wall. Basically what I want to do is determine the frequency of a signal using an MSP430. I have written the code and it works when I connect my oscilloscope 1kHz output to it. However, what I really want to do is to read the frequency of a sine wave I have generated using an oscillator circuit. I pass it though an opamp which goes rail-to-rail (ie from 0 to 3.5V - same as the micro) and the output to the GPIO. However, the micro doesn't seem to register anything. I thought reading a GPIO input is simply a voltage. If the voltage swing is big enough it is should read it as a 0 or 1 regardless the shape of the waveform no?
 

ErnieM

Joined Apr 24, 2011
8,377
I don't use the MSP430, but there is nothing special about reading a pin driven off an op amp. All that matters are the levels, so if you go from near ground to near Vdd you have a valid "logic" signal from your op amp.

Can you try something else to see if the pin responds? Like set another pin high if this input is high. You can use a simple switch and a voltmeter to spy on that circuit.
 

dl324

Joined Mar 30, 2015
16,923
Welcome to AAC!
I pass it though an opamp which goes rail-to-rail (ie from 0 to 3.5V - same as the micro) and the output to the GPIO. However, the micro doesn't seem to register anything. I thought reading a GPIO input is simply a voltage.
I haven't used MSP430 either, but you're probably going to need to set the GPIO to edge detection if you want to measure frequency.
 

BR-549

Joined Sep 22, 2013
4,928
I am not familiar with that chip either. 1000 Hz is a pulse every millisecond. That is a very long time. Use a real time clock or run counter, if you got one.......or set up a timer. And setup an interrupt on the input pin. Now.....just count the ticks between interrupts...........and now convert to time......and then into frequency.

Perhaps a look up table for high frequencies.
 
Top