Hi Rajesh,
I understand that you are working with a model which has a Parameter Writer block and Discrete Pulse Generator block as primary blocks where you want the Parameter Writer to write the “pulseWidth” parameter of the Discrete Pulse Generator block. I assume that the following model matches the workflow you are trying to achieve. I tried generating code for this simple model and it seems to work for me without any issues:
I would encourage you to include implementation details such as screenshots of your model or include the model files if you can in the question. I found that to generate code from above model using embedded coder you have to set the “Default Parameter Behaviour” in the model settings to “Tunable”.
Also, ensure that you have defined the variables which will be used as values for your model parameters in the Base Workspace or Model Workspace:
PulseWidthVar = Simulink.Parameter(5);
PulseWidthVar.StorageClass = 'ExportedGlobal';
Making PulseWidthVar's storage class as 'ExportedGlobal' will tell Simulink to have it as a globally defined variabled in the generated code.
Hope this resolves the issue!