relay_1 = ~relay_1;
relay_2 = ~relay_2;
relay_3 = ~relay_3;
relay_4 = ~relay_4;
relay_5 = ~relay_5;
relay_6 = ~relay_6;
relay_7 = ~relay_7;
relay_8 = ~relay_8;
final_1 = (128*relay_1+64*relay_2+32*relay_3+16*relay_4+8*relay_5+4*relay_6+2*relay_7+1*relay_8);
data = final_1;
i=1;
while(data!=0){
binary_number_1[i++] = data % 2;
data = data/2;
}
for(i=i;i<=8;i++) //I have to add this line to make complete 8 bit data
{
binary_number_1[i] = 0;
}
for(j = i-1;j> 0;j--){
ser_ds = binary_number_1[j];
ser_shcp = 1;
#asm("nop")
ser_shcp = 0;
//delay_us(1);
}
ser_stcp = 1;
#asm("nop")
ser_stcp = 0;