select_unit

 

 

// 設置 control 的 pin
sbit u1_e=P2^3;
sbit u2_e=P2^4;
sbit u3_e=P2^6;

void select_unit(uchar con)
{
 con&=0x03;
 u1_e=0;
 u2_e=0;
 u3_e=0;
 switch(con)
 {
  case 0:
          break;
  case 1: 
          u1_e=1;   
          break;
  case 2: 
          u2_e=1;   
          break;
  case 3:
          u3_e=1;
          break;
 }
}