You set the TRIS bits for 0's for the port pins you want to write to; i.e. setting TrisB to '11110000'B would leave RB7..RB4 as inputs but make RB3..RB0 outputs. The TRIS bits are 'usually' write-only; you usually know how you last left them set.
Microchip does not intend to support the TRIS instruction in future products.
In place of a TRIS command, use a MOVWF TRIS(A,B,etc) assuming that W is loaded with the desired mask. You also need to switch to bank 1 before doing the movwf command, where the tris addresses then match the port addresses. That's why people still like to use the tris command - no bank switch is required. If the tris command exists for a chip, it will always exist for that chip - Microchip cautions against using it in the case of using the same software on a future product that will not have the tris command. In the my16F87x data sheet, they emphatically say DONOT USE the tris instruction. In fact, on the '877, the TRIS command works only on ports a, b, c not d, e
Questions:
Comments:
I am a begginer in Software field but i can well understand and do coding i believe.i am writing soft ware for 10x8 key matrix for 16F883 controller.I tried to initialise all the port as per how i want to use for my application. but the GPIO values are not updating when i am using the HI-TECH compilor.is there any special sequence of register initialisation which we need to follow strictly to get it done correctly..And is there any site or book from which i can get a sample code in C for my applicationJames Newton of Massmind replies: Certainly HI-TECH must provide some code samples that setup GPIO?+
file: /Techref/microchip/tris.htm, 3KB, , updated: 2012/9/24 16:28, local time: 2024/11/25 23:36,
18.191.93.18:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/Techref/microchip/tris.htm"> TRIS</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.