Radio-Buttons

Comprehensive CAN monitor for Windows® and its add-ins: Plotter, CANdb Import, Instruments Panel, and J1939
Post Reply
technikadonis
Posts: 2
Joined: Thu 4. Oct 2012, 21:45

Radio-Buttons

Post by technikadonis » Thu 4. Oct 2012, 21:52

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

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Radio-Buttons

Post by PEAK-Support » Fri 5. Oct 2012, 12:36

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
Attachments
Rocker-Test.zip
PE5 Project für Rocker Switch Test
(4.07 KiB) Downloaded 420 times
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

technikadonis
Posts: 2
Joined: Thu 4. Oct 2012, 21:45

Re: Radio-Buttons

Post by technikadonis » Sun 7. Oct 2012, 11:41

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

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Radio-Buttons

Post by PEAK-Support » Sun 7. Oct 2012, 14:41

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.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Post Reply