Page 1 of 1
Radio-Buttons
Posted: Thu 4. Oct 2012, 21:52
by technikadonis
Hi,
ist es möglich auf einem Frontpanel eine "Radio-Button-Group" zu definieren?
Ich schalte mit mehreren Schaltern einzelne Bits um, die nicht gleichzeitig gesetzt sein sollen.
Mfg Technikadonis
Re: Radio-Buttons
Posted: Fri 5. Oct 2012, 12:36
by PEAK-Support
Hier ein PE5 VBS Macro das die Rocker-Switch simuliert. Das komplette PE5 Projekt (UserPanel wird benötigt) liegt im Anhnag des Post zum herunterladen.
Code: Select all
'------------------------------------------------------------------------------
'FILE DESCRIPTION: A description was not provided.
'------------------------------------------------------------------------------
Sub SiemensRockerSwitchTest()
'DESCRIPTION: Sample macro to send a sinus signal
If Not Connections(1).IsEnabled Then
MsgBox "Please enable the TestNet connection!",,"Error"
PrintToOutputWindow "Please enable the TestNet connection!"
Exit Sub
End If
Dim StopSig, SW1, SW2, SW3
' Get the stop signal, which is set by the Stop button in the panel
Set StopSig = Signals("Stop")
StopSig.Value = 0
Set SW1 = Signals("Switch1")
SW1.Value = 1
Set SW2 = Signals("Switch2")
SW2.Value = 0
Set SW3 = Signals("Switch3")
SW3.Value = 0
If StopSig Is Nothing Then
MsgBox "Signal not found!" & vbCrLf & _
"Please make sure that the file Test-Symbol.sym is assigned to the TestNet connection.",, _
"Error"
PrintToOutputWindow "Please make sure that the file Test-Symbol.sym is assigned to the TestNet connection."
Exit Sub
End If
' Run the "Highlander Switch"
Do While StopSig.Value = 0
if SW1.Value = 1 Then
SW2.Value = 0
SW3.Value = 0
PrintToOutputWindow "Drive aktiv"
wait 300
end if
if SW2.Value = 1 Then
SW1.Value = 0
SW3.Value = 0
PrintToOutputWindow "Neutral aktiv"
wait 300
end if
if SW3.Value = 1 Then
SW1.Value = 0
SW2.Value = 0
PrintToOutputWindow "R³ckwõrts aktiv"
wait 300
end if
Loop
PrintToOutputWindow "Stop pressed"
' Stop button was pressed!
End Sub
Re: Radio-Buttons
Posted: Sun 7. Oct 2012, 11:41
by technikadonis
Hallo Herr Wilhelm,
vielen Dank für die Antwort, nachdem ich das Makor endlich gestartet hatte, funktionieren die Rocker-Switchs.
Jetzt stehe ich aber anscheinend noch auf der Leitung, wie ich mit diesen Switchs "Signale" aus einem Sym-File beeinflusse, sodass der Zustand der Switchs auf dem CAN übertragen wird.
Muss ich hierfür in der "Do While"-Schleife statt "PrintToOutputWindow" einen Befehl zum Absetzen einer CAN-Nachricht ausführen?
mfg technikadonis
Re: Radio-Buttons
Posted: Sun 7. Oct 2012, 14:41
by PEAK-Support
Sie verändern doch schon Signale innerhalb des Macros. Wenn sich der Status eines Schalters ändert, wird doch das *.Value eines echten Signals verändert. Diese Signale sind in der SYM Datei definiert. Wenn Sie weitere Signale verändern wollen, dann machen Sie das auf die gleiche Weise.