Hi, I am writing a control application using Hi-Tech "C" compiler using PIC18F6720. The device has a range of Digital inputs and outputs that are not physically assigned in a sequential manner (ie. RC1,RC4,RB5 etc) but I would like to refer to them logically in the program as an array of sequential bits. Up till now I have being using #define to assign ports. ie. #define D0 LATC1 #define D1 LATB5 etc. In the firmware I have an array that represents the status of the IO ports. example: DoutStatus[x]. I want to be able to switch the IO on/off in a simple loop for(x=0; x<=maxIO; x++) { Dout[x] = DoutStatus[x]; } I am wanting to avoid a drawn out methos as shown below... if( Dout[1] == true) then Dout1 = true; else Dout1 = false; if( Dout[2] == true) then Dout2 = true; else Dout1 = false; Maybe there is a lookup array that defines the Address of the SFR and the bit mask for each Output ? This still seems a bit messy. Thanks in advance Regards David -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist