Interaction of ModellingToolkit with C code

Hi All, I am trying to model a converter using ModellingToolkit whose control lies in a c file. The control is being called at a regular interval using ccall and periodic callback. It seems impossible to integrate the variable updated from c file into the model as it is not reflecting as an unknown.

Does anyone have an idea how to resolve this.
Below is the code for reference.