samedi 26 novembre 2016

is else if statement correct or not? [on hold]

Please give solution this!

.#include<regx52.h> sbit mybit1=P0^1; sbit mybit2=P0^2; void delay(); void main() {     mybit1=1;                           //P2^1 set as an input  mybit2=1;           //P2^2 set as an input  if(mybit1==0 && mybit2==0)  {       P1=0x09;        delay();            P1=0x01;            }       else if(mybit1==1 && mybit2==0)         {           P1=0x02;        }       else if(mybit1==1 && mybit2==1)         {       P1=0x0C;            delay();            P1=0x04;                            } void delay()          {   int count,sec;  for(sec=0;sec<3;sec++)  {       count=0;        while(count!=500)       {           TMOD=0X01;          TH0=0xF8;           TL0=0xCC;           TR0=1;          while(TF0==0)               TR0=0;          TF0=0;          count++;        }}}     }***    

Aucun commentaire:

Enregistrer un commentaire