Re the second example...
A Variable is a Variable, and a Port is a Port. You CAN'T define one as another which is why the second example is illegal. You CAN make a Port equal the state of a Variable, or you can make a Variable equal the state of a Port.
Going back to your problem... if you have arranged your 16-bit BUS illogically and without thought scattering it randomly across many Port Pins, then you can only gather it together with (worst case) sixteen individual statements like so...
Myword.0=PortA.3
Myword.1=PortB.7
Myword.2=PortB.3
Myword.3=PortB.5
Myword.4=PortA.0
Myword.5=PortC.4
and so on...
The best scenario was you had your 16-bit bus arriving sensibly at two PIC Ports and you caould have gathered it like so...
Myword.Lowbyte=PortB
Myword.Highbyte=PortC
You can of course redefine the name 'Myword', and you can redefine the Port names, but you CANNOT automatically associate a physical lump of Hardware (ie a Port pin) to a virtual object (ie a RAM variable).
Bookmarks