Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need help with variables in code vision AVR

Status
Not open for further replies.

djc

Advanced Member level 1
Joined
Jan 27, 2013
Messages
402
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,298
Location
India
Activity points
4,554
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.

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.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top