Reading opamp output from a GPIO

Status
Not open for further replies.

chris43j

Newbie level 2
Joined
Apr 13, 2017
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
19
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?
 

Hi,

A GPIO is not meant to read sine waveform.
The microcontroller specifications show V_IH and V_IL.
The signal should not be inbetween both levels, best if the signal is close to either supply rails.

Use a comparator pin or use an external comparator to generate a digital signal.

Klaus
 
That seemed to work. Was pretty straight forward to set up actually. I ended up using the onboard comparator which can can feed into the timer capture input. Thanks!
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…