> >> I really think the appropriate port bits can be set low once, during >> initialization using a movwf. > that depends on what your app is doing with the rest of the port > >> Then you can do bsf and bcf TRIS all you >> want. The read/modify/write problem is only a problem when dealing with >> a >> PORT and is due to external loading keeping a pin from moving >> immediately >> after a write. > that is one situation in which it occours yes > > the problem that is relavent to this discussion comes when you are using > some outputs on a port as open collector ans some as normal outputs. > > lets say there is a normal output on A1 and a pin being driven as open > collector by use of tris on A0 which is pulled high > > #init, all of port A as an output driving low > CLRF PORTA > CLRF TRISA > > #make A0 an input allowing it to float high > BSF TRISA,0 > > #make A1 high, > #unfortunately due to RMW this also makes bit 0 of PORTA high > BSF PORTA,1 > > #make A0 an output again, we throught we would be making > #it drive low but in fact we end up making it drive high > BSF TRISA,0 > > of course if we used LATA rather than PORTA this code would be fine but > unfortunately only the 18 series have LAT. > I agree completely! Another way around this is to keep a mirror of the PORT in RAM. Do the bsf and bcf on the mirror, then copy it to the port. Harold -- FCC Rules Updated Daily at http://www.hallikainen.com - Advertising opportunities available! -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist