How to detect logic level?
lardom
Posts: 1,659
I did some basic tests with the LM339 by setting the ground input to 1/2 Propeller supply. Turning the potentiometer I measured voltage at the output. It worked. Next I wrote a simple method and pressed F10. I found I could only get an led to light up if I touched the wire connected to the comparator output. I'm stumped. Please help.
PUB main dira[11]~~ dira[13]~ outa[11]~ repeat if ina[13] 'comparator output outa[11]~~ 'LED connected here waitcnt(clkfreq/2 + cnt) outa[11]~
Comments
I have to fine tune the circuit but at least I know I'm on the right track.
Depending on the maximum voltage you are testing keep the current to less than 0.5mA.
10K for 5V
20K for 10V
360K for 120VAC
Duane J
There may be a couple of reasons why you are not seeing this.
1. There may be some delay from the BLDC voltage and the output to ina making it seem the transition isn't 1.65V.
2. There may be noise from the BLDC.
BTW, I agree with the use of the comparator to eliminate voltage differences between the Prop's ground and the motors.
Also, generally comparators do the "Comparison function" much better than Op-Amps because they are much faster and inputs don't saturate primarily because the gain is low.
A bit of caution though. LM339 doesn't tolerate input voltages outside the specified range. I can't find it in the spec but I remember that the LM339 may invert the expected output polarity when outside the specified range. No damage but unexpected operation.
There are comparators that guarantee proper output polarity even when outside the specified input range.
Duane J
This is a kind of Differential Input Voltage Comparator.
Duane J