Hello Alan & PIC.ers, ----- Original Message ----- From: "alan smith" > Using a PIC18F and writing in assembly, I have a group of outputs > sprinkled among > several ports to turn on LEDs and the like. > > The idea is I have a group of registers, where I keep track of what > device is being enabled. Only one output on at a time, per each register. > > For example: > > LeftSide is a register, bits [4:0] where only one bit is active at any > given time. > RightSide is similar. > > But, the 5 bits that are to be driven are perhaps in PortA, PortB and > PortD... > basically to make the board layout easier because afterall...each bit in > each port > is controlled via LAT opcode... > bsf LATA,0 > I had a similar situation where I wanted to layout a drive to a 44780 lcd module. If I'd tried to use the port pins available, sticking to the original schematic all neat and regular then the pcb would have ended up like a rats-nest. Better to wire it up as directly as possible, then make the adjustment in s/w. I just wrote a macro for it, ugly as all hell but works like a charm. convert_o_patt_for_LCD_PCB MACRO ;this macro `fixes up' the abnormal pin configuration on ;the i2c 8574 > 44780 pcb clrf scratch6 ;bit logical 44780 job >converts to> ;physical bit no btfsC o_patt,0 ;0 DB4 >> bit 3 bsf scratch6,5 ; btfsC o_patt,1 ;1 DB5 >> 1 bsf scratch6,1 ; btfsC o_patt,2 ;2 DB6 4 bsf scratch6,6 ; btfsC o_patt,3 ;3 DB7 6 bsf scratch6,0 ; btfsC o_patt,4 ;4 EN 5 bsf scratch6,2 ; btfsC o_patt,5 ;5 R/W 0 bsf scratch6,4 ; btfsC o_patt,6 ;6 RS 2 bsf scratch6,3 ; movff scratch6,o_patt endm ...should give you the general idea... I'm sure someone here has a much more elegant way. best regards, John email from the desk of John Sanderson. JS Controls, Manufacturer & Purveyor of laboratory force testing apparatus. PO Box 1887, Boksburg 1460, Rep. of S. Africa Tel / Fax: +27 11 893 4154 Cell: 082 741 6275 Web: www.jscontrols.co.za -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist