Change of Connections

Professional Windows® software to communicate with CAN and CAN FD busses and its add-ins: Plotter, CANdb Import, Instruments Panel, and J1939
Locked
Krishna.skt
Posts: 21
Joined: Mon 6. Apr 2020, 15:33

Change of Connections

Post by Krishna.skt » Fri 29. May 2020, 14:31

Hello,
Is it possible to Change the Connections by using VBScript macro? Actually I am working with a System where i Need to deal with Connections with three different bit rate and i want to do it in a automatic way. I can Change it manually while running the macro with the help of Wait instruction but it's not really practical. Is there any other way to make it possible automatically or more practical in Manual way? Any help would be appreciated.
Here in the Picture you can see my three Connections with different Bit rates and i Need to Keep changing between These Connections while running my macro.
Image

Krishna.skt
Posts: 21
Joined: Mon 6. Apr 2020, 15:33

Re: Change of Connections

Post by Krishna.skt » Fri 29. May 2020, 14:33

Sorry, the Picture was not attached earlier, i guess. It's attached now.
Attachments
CANConnections.PNG
CANConnections.PNG (12.9 KiB) Viewed 3702 times

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Change of Connections

Post by M.Heidemann » Fri 29. May 2020, 15:46

Hello,

Here an Example switching between 3 Nets with 3 different baudrates on the same connection:

This will switch the Net for the same connection, which is easier to handle since the nets are globally available to all your PCAN-software clients:

You need to create the corresponding Nets with the needed Bitrate up front.

Make Sure your netnames, connectionname and the names in your code match.

Code: Select all

' Set the Connection1 to 125K Net
Sub Set125KNet()
   Connections("Connection1").Connection = "125k@pcan_usb"
   PrintToOutputWindow "Now start 125K"
End Sub

' Set the Connection1 to 250K Net
Sub Set250KNet()
   Connections("Connection1").Connection = "250k@pcan_usb"
   PrintToOutputWindow "Now start 250K"
End Sub

' Set the Connection1 to 500K Net
Sub Set500KNet()
   Connections("Connection1").Connection = "500k@pcan_usb"
   PrintToOutputWindow "Now start 500K"
End Sub

Alternatively you can deactivate and activate Connections using the "IsEnabled" property of the "Connection" -object:
IsEnabled.PNG
IsEnabled.PNG (38.28 KiB) Viewed 3697 times
IsEnabledDetails.PNG
IsEnabledDetails.PNG (45.29 KiB) Viewed 3697 times
You can disable a connection like this (Using its connection name)

Code: Select all

Connections("Connection1").IsEnabled = False
And enable one like so:

Code: Select all

Connections("Connection1").IsEnabled = True

Best Regards
---
Marvin Heidemann
PEAK-Support Team

Krishna.skt
Posts: 21
Joined: Mon 6. Apr 2020, 15:33

Re: Change of Connections

Post by Krishna.skt » Wed 3. Jun 2020, 08:55

Hello there,
Thank you for your responce. This would solve my Problem.

Locked