Hello,
I am not sure what do you mean by "While, trying with the hardcode (embedded C) its working as intended.". Can you give more details about the steps you took and if there were any errors?
Also, please do not open multiple threads regarding the same problem. Let's just stick to a single thread. If you need to add furthers details to a thread, you can easily use the Reply button on your own message.
Best regards,
Sorin Ioanid Bancila