Why does a uint64 input specified by a Data Type Conversion to an Extract Bits block result in the error "PLC Coder does not support externally defined operators" for PLC Code Generation?

3 vues (au cours des 30 derniers jours)
I try to upcast a "uint32" signal to "uint64" with a Data Type conversion block and feed it into an "Extract Bits" block. I get an error while trying to generate PLC code for my model in this segment. The error states:
<BlockPath>/Extract Bits/Extract Desired Bits' is configured to implement an operator that is externally defined. PLC Coder does not support externally defined operators.
I have used extract bit block in other places in my main model and i don't get this error. Why does this occur and how can I fix the issue?

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 10 Fév 2020
The root-cause of the issue is that 64 word- length Fixed point numbers are not supported by PLC Targets and are therefore not supported for PLC Code Generation.
You mentioned that the "Extract Bits" blocks function well in other parts of the model without errors. To justify this, other uses of Extract Bits in the model deal with data types that are supported by Simulink and PLC Code Generation (Display data types by clicking "Display"-> "Signals & Ports" -> "Port Data Types"). Please see the allowed data types for this block:
You will observe that the output of the "Data Type conversion" block this level may output "ufix64" instead of the requested "uint64". Because the "Extract Bits" block cannot accept "uint64", it inherently converts this to a Fixed point 64 type. While this datatype is acceptable to the "Extract Bits" block for Simulink simulation, PLC Coder does not support it. Please see the acceptable Fixed point data types for PLC Coder:
So the workaround in this case would be to use an acceptable data type. If you removed the data type conversion block, this would not error as "uint32" is acceptable for the "Extract Bits" block and rework your algorithm to fit your needs.

Plus de réponses (0)

Catégories

En savoir plus sur Simulink PLC Coder dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Produits


Version

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by