djc
Advanced Member level 1

I am working with code on 16 line hot line system. There is one master and 15 slaves. Whenever any slave pick up the phone ring goes to master. Its happening with my code. Now another condition is when master gets on hook again, it should not ring again if slave is still off hook. Rest of the things are working fine but i am unable to satisfy next condition. Please guide me. Here is my code.
phn_10 is slave and phn_11 is master.
Code:
while (1)
{
register unsigned int k=0;
phn_1=1,phn_2=1,phn_3=1,phn_4=1,phn_5=1,phn_6=1,phn_7=1,phn_8=1,phn_9=1,phn_10=1,phn_12=1,
phn_13=1,phn_14=1,phn_15=1,phn_16=1;
// Place your code here
master=0;
//delay_ms(5 );
while((phn_10==0) ){
//delay_ms(20);
if(k==0){
if(phn_11==1){
while(1){
if(phn_10==1){
master=0;
j=0;
ring=1;
break;
}
else if (phn_11==0){
master=0;
ring=1;
j=0;
k=1;
break;
}
else
//toggle();
k=k+1;
master=~master;
delay_ms(1000);
}
}
}
if((phn_1 == 0) ||(phn_2 == 0) ||(phn_3== 0) ||(phn_4 == 0) ||(phn_5 == 0) ||(phn_6 == 0) ||(phn_7 == 0) || (phn_8==0) ||
(phn_9==0) || (phn_10==1) || (phn_12==0) || (phn_13==0) || (phn_14==0) ||(phn_15==0) || (phn_16==0)){
i=0;
k=0;
j=0;
master=0;
break;
}
}
phn_10 is slave and phn_11 is master.