1. smart_prosoft

    Thread Starter New Member

    Apr 21, 2013
    1
    0
    void send_data(unsigned int temp){
    unsigned int Mask = 0x0001, t, Flag;
    for (t=0; t<16; t++){
    Flag = temp & Mask;
    if(Flag==0) Serial_Data = 0;
    else Serial_Data = 1;
    SH_Clk = 1;
    SH_Clk = 0;
    Mask = Mask << 1;
    }
    I WANT TO KNOW WHAT THE MEANNING OF
    unsigned int Mask = 0x0001, t, Flag;
    HOW WE CAN MAKE INT =THREE VALUES
     
  2. cravenhaven

    Member

    Nov 17, 2011
    34
    2
    I think it means that there are 3 variables declared as unsigned int; Mask,t,Flag. Additionally Mask is assigned an initial value of 0x0001.
    It could also be written:
    unsigned int Maxk = 0x0001;
    unsigned int t;
    unsigned int Flag;
    .
    .
    .
     
  3. Brownout

    Well-Known Member

    Jan 10, 2012
    2,375
    998
    You are correct.
     
  4. Art

    Distinguished Member

    Sep 10, 2007
    785
    61
    Flag, temp & mask are all incidental variables.
    rotating the mask and anding it sixteen times to iterate the bits of a sixteen bit value.
    It's because C wasn't made to access bits directly.
    A bit bang routine would look different in any other language.
     
Loading...