What that mean

Thread Starter

smart_prosoft

Joined Apr 21, 2013
1
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
 

cravenhaven

Joined Nov 17, 2011
34
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;
.
.
.
 

Art

Joined Sep 10, 2007
806
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.
 
Top