Fair enough. I've not had hobby time to use the little PICs for a=20 while. Mostly PIC24 and PIC32 with C. Efficiency isn't in that vocabulary= .. Bill On 3/6/2017 7:03 PM, Dwayne Reid wrote: > Hi there, Bill. > > Two reasons: speed and code size. Being able to use the TRIS > instructions means that I don't have to spend time changing RAM banks. > > Don't get me wrong - I routinely control the DDR register bits from > RAM Bank 1 when I need to. But for either simple stuff or speedy > stuff where I can tolerate all of the DDR bits being changed for a > particular port, the TRIS instruction gives me significant savings. > > dwayne > > > At 01:25 PM 3/6/2017, William Bross wrote: >> Dwayne, >> >> Any special reason you just don't want to write directly to the TRISx >> register? The old TRIS command was really only meant for the baseline >> stuff, where 5 - 7 are ports A - C. Not being critical here, just curio= us. >> >> Bill >> >> >> On 3/6/2017 2:13 PM, Dwayne Reid wrote: >>> Hi there, Richard. >>> >>> I'll give this a try. >>> >>> I must confess: when I saw that the TRIS operands of 5..7 didn't >>> match up with the actual register addresses of 0x0C..0x0E, I stopped >>> and didn't give it a try. >>> >>> My code does things like: >>> >>> movlw b'0011001100' >>> tris RA >>> >>> where RA is defined as the address of port register RA >>> >>> The assembler complained that address 0x0C wasn't in the range of 5..7 >>> >>> I guess that what you are saying is that the TRIS operand doesn't >>> have to match the port register address. I'll give that a try. >>> >>> I'll let you know how the actual chip behaves. >>> >>> Many thanks! >>> >>> dwayne >>> >>> >>> At 02:23 AM 3/5/2017, Richard wrote: >>> >>>> Dwayne, >>>> >>>> I tried that with MPLAB IDE v8.85 (uses mpasmwin.exe v5.45) and it >>>> worked okay. >>>> >>>> The test code I used is: >>>> >>>> #include "p16f1782.inc" >>>> >>>> MOVLW B'00111000' ;Set RA<5:3> as inputs >>>> TRIS 5 ;set TRISA to value in W >>>> end >>>> >>>> Build was successful and simulator showed expected results. >>>> >>>> Richard > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .