Hi Amit,
The function scanf belonging to library stdio should work correctly. I'm using the board: FRDM-K20D50M to test the following code and this works.
Note: I added a component more (BitIO from Component Library) in order to display the result in the board. This component named "Bit1" was configured like "output" on pin: "PTD4".
Can you check that the stdio library is included in "CsIO1.h" file in "Generated_Code" folder?, just to check that there is not the problem. (:
unsigned char lub_character_received;
/* comments */
PE_low_level_init();
/* Write your code here */
while(1)
{
scanf("%c", &lub_character_received);
if(lub_character_received == '0')
{
Bit1_PutVal(FALSE); /* function used for BitIO component */
}
else if(lub_character_received == '1')
{
Bit1_PutVal(TRUE);
}
else
{ /* do nothing */ }
}