Hi - unfortunately I don't think this is possible in CCS, and probably not in other PIC C compilers, but that's just a guess. What you're trying to do is something like this: typedef union { byte Byte; struct { word SCME :1; /* Self-clock mode enable */ word PCE :1; /* COP Enable during Pseudo Stop Bit */ word PRE :1; /* RTI Enable during Pseudo Stop Bit */ word :1; word ACQ :1; /* Acquisition */ word AUTO :1; /* Automatic Bandwidth Control */ word PLLON :1; /* Phase Lck Loop On */ word CME :1; /* Crystal Monitor Enable */ } Bits; } PLLCTLSTR; (this is from a header file for the freescale MC9S12NE64) so that in code you can say: PLLCTLSTR foobar; (with some compiler-dependent pragma to set foobar to the correct special chip register) then: foobar= 0xFF; or foobar.PRE= 1; etc. but for splitting across two 8-bit registers, the union{} would have to cover both, and any assignment directly (like foobar= 0x0123) would set all the pins on both ports. Even if this is possible in other compilers, they are going to generate a number of masks and shifts and so forth, so it won't be smaller/faster than how you'd do it "by hand". So I think you're going to have to write a function to do writes to your LCD. See bit_set() and bit_clear() CCS functions to efficiently set/clear a single bit. Alternatively something like: PORTA= (PORTA & 0x7) | ((LCDdata & 0b0111000) >> 5); would set the lowest 3 bits of PORTA to bits 6,5,4 of LCDdata. Also see #inline, you may want your function inlined for speed. This low-level bit-bangyness takes up a remarkable fraction of the code for many of my projects. It isn't always possible to arrange the hardware pin layouts to make the software simpler, as I guess you've discovered as well. :) J moja nona wrote: > Hello. > > Situation: Driving a LCD. 3 pins are say on PORTA, 4 pins are on > PORTB. I am using CCS for programing. Is there a way to group the > pins of both the ports into a single register? The code would be > easyer/prettyer. > > Regards! -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist