B&R: Aufzählungstyp in DINT wandeln

In der Hilfe unter Programming/Libraries/IEC61131/Convert findest du die Funktionen.
Was ist eine Aufzählungsvariable ?

Code:
The input value is converted to the UDINT data type. Since there are 32 bits  in the UDINT data type and UINT has only 16 bits, no overflow can occur in this  conversion.
 [h=2]Call syntax[/h] [B]Structured Text:[/B]
   udintVar := [COLOR=#0000ff]UINT_TO_UDINT[/COLOR](uintVar); Alternative for [B]B&R Automation Basic[/B]:
Only the target data type  is specified in B&R Automation Basic
   udintVar = [COLOR=#0000ff]UDINT[/COLOR](uintVar) Alternative for [B]ANSI C[/B]:
Upward conversions are easy to assign in  C.
   udintVar = uintVar;
[\CODE]
 
Wird ein ENUM nicht automatisch in einen DINT konvertiert, wenn du einem DINT einen ENUM zuweist? Zumindest in AB funktioniert das meines Wissens prima.
 
Zuletzt bearbeitet:
Zuviel Werbung?
-> Hier kostenlos registrieren
Jetzt hab ich es mal probiert

Die Aufzählungsvariable ist eine UDINT. Und wenn man diese mit diColor3 := UDINT_TO_DINT(Red); convertiert funktionierts auch.

Enum.JPG
 
Zurück
Oben