Voltage Comparitor
John Whitfield
Posts: 42
I am designing a lightmeter using the comparitor on rb and since I'm using rb as my com port already since I am using the core of my old multimeter program. I'm not sure if the com port and comparitor and confusing things and that's why it doesn't appear to be·working or if there's something I'm missing in the set up. Anyway here's the code I have now.
Thanks,
-John Whitfield
Thanks,
-John Whitfield
Comments
Without spending too much time with your code, there's always a chance that you are stomping on a seting or an input or output value by using a single port for more than one function. There's nothing wrong with using a port for more than one functin, it's just that you run the risk of making a mistake. In your case, since you have for more port pins than you are using, just separate things. This is the whole point of using named constants in your code (which you do already) instead of hard coding things in the source body.
In your case I would just make a small change, so this:
...becomes...
And, voila', you have now moved the serial communications from port b to port a, and you have separated the two functions onto different ports.
Thanks, PeterM