Main Content
Use Enumerated Data in a C Function Block
This example shows how to define and use enumerated data in a C Function block. In this example, a series of traffic lights are defined in an Enumerated Constant block using the Data Type Assistant. The code that controls the traffic lights is written in the Output Code pane of the C Function block dialog. In the Symbols table, the data types of the block inputs and outputs are defined as Enum:
classname. In this example, the enumerations are defined in the class TrafficLightColor_t
, so the type is defined as Enum: TrafficLightColor_t
.
open_system('CFunctionEnum')
Output Code to Switch Traffic Lights
Symbols Table to Define Enumerations