for the 16f876, i need to know how to set the trisa. they give examples like trisa%11111111
but trisa only has 6 ports on the 16f876. How do I state this?
for the 16f876, i need to know how to set the trisa. they give examples like trisa%11111111
but trisa only has 6 ports on the 16f876. How do I state this?
It is
It reads from right to left. The right being PORTA.0Code:TRISA = %111111
So just use 6 places.
Dave
Always wear safety glasses while programming.
$20 says that the next post says that the ports don't read correctly...
Your answer is spot-on Dave.
But you can also use all eight bits in your TRIS statement, the upper bits of Ports that don't exist will simply be ignored.
This certainly works for multi-family PICs like the 16F876 who has a bigger brother (the 16F877) that does have those pins, and the internal archetecture is shared. If the Datasheet says the Register has eight bits (even though some are unused), you can still send eight bits to that Register, the unused ones will just be ignored.
The advantages are that is you ever migrate to the bigger PIC, your TRIS (and other Register) statements aren't going to throw you a curve-ball because you've accidentally left them undefined.
Some PICs (like the 18F2520) have a PortE.3 all on it's own. In this instance you can set the TRIS bit on it's own, or you can still send all eight (or just four) bits to the Port, however all but E.3 will be ignored.
Well, my point was that the '876 has been obsoleted for awhile now, and most likely hard to get. And that the O/P might've actually meant '876A, which, as we all know, a LOT of newbs have trouble with PortA on that and many other PICs.
Bookmarks