Hi Jon, Unfortunately not as they aren't continuos in memory.. However just write a macro or even an inline function this should make it all much more readable. for instance: #define WRITE_16BIT_PORT( val ) {PORTA = val & 0xff; PORTD = val >> 8;} #define READ_16BIT_PORT( val ) {val = (PORTD << 8) | PORTA;} Hope that helps.. Cheers, Ash. --- Ashley Roll Digital Nemesis Pty Ltd www.digitalnemesis.com Mobile: +61 (0)417 705 718 > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Jon Baker > Sent: Thursday, 25 April 2002 9:02 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]: C query > > > I'm using an '877 on a 16bit bus, MSB is PortD, LSB is PortB. > I need to read or write to the bus, and I would like to know > if I can create a variable in C which references these two > ports as though they were a single 16bit unsigned int- so > instead of having to do msb and lsb operations individually. > PORTB = int & 255; PORTD = int >> 8; I could use a single > variable [eg PORTDB ] in these operations: PORTDB = int; > > obviously the compiler will split it up into 2 8bit > operations, and I don't even care if the code is smaller or > (slightly) larger- but it would really make my code easier to > get my head around at the moment :) > > Thanks > > Jon Baker > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.