bit storing as byte

I have code written for function 3 modbus RTU , Now i Need to modify code for function1

difference between bits and byte store. function3 uses byte store & function1 use bit store. Now in above code i am getting input request from master coming well.

I.e request goes in 01 01 00 00 00 31 fd de

based on request i need to send response back. where
rxbuf[2]= 00 //higher byte of start address
rxbuf[3]= 00 //Lower byte of start address
rxbuf[4]= 00 //HI Number of Bits
rxbuf[5]= 31 //LO Number of Bits
data to be read from starting address
0 to 31 bit address. I am facing problem in

  1. calculate length & address of length.
This for function 3, need length calculation for bits
 length=(rxbuf[5]*2);
   address=(address*2);
  1. Storing bits values in array_data[]
Byte_Addr[0]={bit1,bit2,bit3,bit4,bit5,bit6,bit7,bit8}
Byte_Addr[1]={bit9,bit10,bit11,bit12,bit13,bit14,bit15,bit16}
Byte_Addr[2]={bit17,bit18,bit19,bit20,bit21,bit22,bit23,bit24}

3)Once data store . pack the Data & send for CRC check

crc_data[0]=Device_ID;
                           crc_data[1]=rxbuf[1];
                           crc_data[2]=length;
                           j=3;
                           for(i=address;i<((address+length));i++)
                          {
                                crc_data[j++]=ser_data[i+3];
                           }
                           crc1 =crc_fn(&crc_data[0],(length+3)); //crc function for response protocol from the device