Can you post your code because mine is not working as expecteduint8_t is the same as unsigned char.
You're using it in the wrong place. I said scanf expected a pointer to int, so you need to use
sscanf("%hhd", &LSB_BIT);
C:
#include<stdio.h>
#include<stdint.h>
int main ()
{
uint8_t Data_Byte = 0;
uint8_t LSB_BIT;
printf("size of LSB_BIT :%d byte \n", sizeof(LSB_BIT));
printf("Set/Reset LSB Enter 1 /0 : ");
sscanf("%hhd", &LSB_BIT );
Data_Byte = ( Data_Byte | LSB_BIT );
printf(" %d\n", Data_Byte );
Data_Byte = Data_Byte << 1;
printf("Byte = %d \n", Data_Byte );
// Byte = 0000 0000 | 0000 0001 = 0000 0001 << 1 = 000 00010 = 2
printf("Set/Reset LSB Enter 1 /0 : ");
sscanf("%hhd", &LSB_BIT );
Data_Byte = ( Data_Byte | LSB_BIT );
printf(" %d\n", Data_Byte );
Data_Byte = Data_Byte << 1;
printf("Byte = %d \n", Data_Byte );
// Byte = 000 00010 | 0000 0001 = 0000 0011 << 1 = 000 00110 = 6
return 0;
}
Set/Reset LSB Enter 1 /0 : 64
Byte = 128
Set/Reset LSB Enter 1 /0 : 192
Byte = 128