cancel
Showing results for 
Search instead for 
Did you mean: 

I am getting the warning: #174-D expression has no effect.

MMüll.5
Associate II

I am trying to get the bits of an uint8_t into an array. I use two for loops for that and don't know why I get this warning.

This is the code I use:

void System_Info_Get_Jumper_State(I2C_HandleTypeDef* hi2c1, uint8_t* Jumper_State_Array_Address)
	{
		uint8_t Jumper_States[2] = {0x00};
		uint8_t Bit_Mask = 1;
		HAL_I2C_Mem_Read(hi2c1, System_Info_Address, System_Info_Input_Register1_Address, 1, Jumper_States, 2, 1000);
		
		for(uint8_t Run_Through = 0; Run_Through <= 1; Run_Through ++)
		{
			for(uint8_t Place = 0; Place <= 7; Place++)
			{
				Jumper_State_Array_Address[Place] = Bit_Mask & Jumper_States[Run_Through];
				Bit_Mask << 1;
			}
			Bit_Mask = 1; 
		}
		
	}

 The warning points to line 12 where the bit shft happens.

1 ACCEPTED SOLUTION

Accepted Solutions

> Bit_Mask << 1;

You wanted to write:

Bit_Mask <<= 1;

JW

View solution in original post

2 REPLIES 2

> Bit_Mask << 1;

You wanted to write:

Bit_Mask <<= 1;

JW

MMüll.5
Associate II

Thank you that solved my problem.