On 22 September 2010 16:10, David Duffy (AVD) wrote: > =A0On 22/09/2010 3:16 PM, Scott wrote: >>> =A0 Up until now, I've only used the older (lower end?) PICs >> 16F and lower don't have LAT. > > You might want to check that. =A0I'm using a 16F1934 and it does indeed > have LATx registers - 5 of them! > >>> I think I understand the difference between PORTx and LATx, but in one >>> data sheet Microchip show port B being initialised like so: >>> >>> BANKSEL =A0 =A0 PORTB >>> CLRF =A0 =A0 =A0 =A0PORTB >>> BANKSEL =A0 =A0 LATB >>> CLRF =A0 =A0 =A0 =A0LATB >>> BANKSEL =A0 =A0 ANSELB >>> CLRF =A0 =A0 =A0 =A0ANSELB >>> BANKSEL =A0 =A0 TRISB >>> CLRF =A0 =A0 =A0 =A0TRISB >>> >>> Why bother clearing TRISB when you would be only writing to LATB anyway= ? >>> David... >> TRIS controls the direction of the pin (e.g. input or output). >> Use PORT when you want to read a digital input. >> Use LAT when you want to write a digital output. >> > > Yes, I understand this. =A0But why bother clearing PORTx when clearing > LATx is really clearing the port? I'm guessing Scott was answering your original Q: 'Why bother clearing TRISB when you would be only writing to LATB anyway?' You've not restated the Q as: 'But why bother clearing PORTx when clearing LATx is really clearing the po= rt?' Which is a completely different Q, (which I don't have an answer for!) Matt --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .