Should this go [OT]?? From Bob A: > So, try this: > ( (union_lo_hi *) ð_length)->b.l = 123; // assign low byte ^ took this out This doesn't compile either - same error messages. Is this a CCS problem? From John D (a while ago - sorry): > My_16bitInt = *(WORD *)&bytearray[5]; This does compile, although with the CCS compiler it is not quite as efficient. To address your other comments, I am always checking to see what the compiler is producing - that's how I got involved in this thread! This seems to be getting quite complex for the original problem. To recap, this part of this thread is discussing a c standard way of addressing the low and high bytes of a word variable, to force more efficient compiling for situations like assigning consecutive array bytes to a word: word_var = byte_array[2] + byte_array[3] * 256; CCS compiles this in 7 instructions with the 18 instruction set - it should be able to do this in 2 - so we really are quibbling about small amounts of code here - but for me, has raised all sorts of interesting c possibiities. John's suggestion above compiles in 9 instructions, while I haven't been able to get the advanced structure/union stuff to compile at all. I've always used CCS's '#byte' directive, which is non-standard c. I thought I would look for something simpler, but I still have questions, if anyone is still hanging with me. It seems just a structure would give the desired access: struct lo_hi {char lo; char hi;}; struct lo_hi word_var; word_var.lo = byte_array[2]; word_var.hi = byte_array[3]; This compiles in the desired 2 instructions; however, when I want to just use the full variable, this works: word_var = 1000; but this doesn't: if (word_var2 > word_var) for the compare, CCS insists on a structure element; I want it treated as a single 16 bit variable. Is this how how these *should* be treated?? Thanks again for any suggestions. -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu