Your code only has 8 bits.... There should be 17 bits SB, W1bits, W2bits..
I assume you are trying to use stacked... You need to redraw your circuit as well..
Here is the code for single wiper..
C:
unsigned char bou[17];
void sendDATA()
{
unsigned char counter = 0; //Declare and initialize the counter
RB3_bit = 1; //Initiate communication through RST
Delay_us(50);
while(counter<17)
{
if(RB4_bit == 0)
{
counter = counter + 1; //counting pulse on the low
RB2_bit = bou[counter]; //Send Data
Delay_us(30);
}
RB4_bit = ~ RB4_bit; //toggle the clock
Delay_us(50); //Duty cycle
}
RB4_bit = 0;
RB3_bit = 0; //Stop communication through RST
}
void main(){
ANSEL = 0; // pins are configured as digital I/O
TRISA = 0xFF; // set PORTA direction to be input
TRISB = 0x00; // set PORTB direction to be output
PORTB = 0;
do{
if(RA2_bit == 0)
{
bou[0]=0;
bou[1]=1;
bou[2]=1;
bou[3]=1;
bou[4]=1;
bou[5]=1;
bou[6]=0;
bou[7]=0;
bou[8]=0;
bou[9]=0;
bou[10]=0;
bou[11]=0;
bou[12]=0;
bou[13]=0;
bou[14]=0;
bou[15]=0;
bou[16]=0;
sendDATA();
}
if(RA3_bit == 0)
{
bou[0]=0;
bou[1]=1;
bou[2]=1;
bou[3]=0;
bou[4]=0;
bou[5]=0;
bou[6]=0;
bou[7]=0;
bou[8]=0;
bou[9]=0;
bou[10]=0;
bou[11]=0;
bou[12]=0;
bou[13]=0;
bou[14]=0;
bou[15]=0;
bou[16]=0;
sendDATA();
}
}while(1);
}
And the circuit.... NOTE 555 ouput needs to go to the top of the wiper as you are trying to keep a 5% duty cycle..
View attachment 98530