628A has analog functions?
P.S. I do have CMCON disabled...
628A has analog functions?
P.S. I do have CMCON disabled...
Yes it does, the comparators are analog and enabled by default.628A has analog functions?
Your code doesn't show that. What does having CMCON disabled mean? What are you writing to it?P.S. I do have CMCON disabled...
From the datasheetWhen you do stuff likeThe PORTA pins are multiplexed with comparator and
voltage reference functions. The operation of these
pins are selected by control bits in the CMCON
(Comparator Control register) register and the VRCON
(Voltage Reference Control register) register. When
selected as a comparator input, these pins will read
as ‘0’s.All bit operations on a register is performed as a read-modify-write operation. The port is read, modified and written back - it's the way it works inside the PIC itself. If the read operation returns a state of a pin that is different to what you set then that erroneous state will be written back to the port and you get "weird" and "unexpected" results. Having analog functions enabled is THE most (un)popular cause of this happening.Code:PortA.0 = 1 PortA.1 = 1
Having too much load, or a capacartive load on the actual output is another cause. In this case the voltage level at the pin isn't allowed to rise to a level where the read operation of the second command actually "gets" a logic 1.
/Henrik.
If you Google read modify write you'll find loads and loads of explainations.
Simple trick to shadow the port with a latch byte and send that to the port at the expense of some speed.
Even though it would have been pins left analogue this time, it will still cause hard to debug problems.Code:portalatch var byte portalatch = 0’ portalatch.bit0 = 1 PORTA = portalatch'
Bookmarks