This is an interesting issue.

IIRC the (some?) 16F chips suffer from the RMW issue. This means that
although an output pin is set to low, it might read back high due to load
or capacity. If you change an other pin on the same port, the operation to
set that particular bit might flip bits of other pins.

However, inverting the pin means RMW at 'user level' and I'd say this is
always prone to the RMW issue, since you tell to read the pin, invert the
value and write it again.

Microchip fixed the RMW issue (due to bit-operations) with the LAT register.

I don't understand what's happening here. A led is no heavy load and 250ms
handles the capacity. So why is the value of the pin not equal to its
driven value?

Joep

PS Actually, this happend to me quite a few times. It always turned out the
pin was set as analog, so reading its digital level was not supported.

PPS I would not be in favor of additional overhead to check pin direction
and select source on that. We're not trying to exceed the Arduino library
overhead, are we? ;)





2011/11/16 mattschinkel <[email protected]>

> > My opinion would be, that the program using
> >
> > led=!led
> >
> > is simply faulty. If one is programming a microcontroller, he should
> have at least some knowledge about electronics. If he doesn't want to care
> about hardware, programming a computer would be the choice.
>
> I disagree, this is not a faulty program. Flipping a led should be
> allowed just like any other variable. If it is left as it is, some
> libraries will not work.
>
> Matt.
>
> --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/jallib?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to