Send message with DLC=0 by Button in Panel

Professional Windows® software to communicate with CAN and CAN FD busses and its add-ins: Plotter, CANdb Import, Instruments Panel, and J1939
Post Reply
m.joerger
Posts: 4
Joined: Fri 22. Oct 2021, 07:52

Send message with DLC=0 by Button in Panel

Post by m.joerger » Fri 22. Oct 2021, 08:06

Hello Forum!

I am trying to send a message with DLC=0 using a Button in a Panel - but I can't do it.

I defined the message in the Symbol file as:

[Tx_Dump_CM_Versions_009033E1]
ID=009033E1h
Type=Extended
DLC=0

When trying to assign the message (signal ?) in the Button-Properties-Data section I can not do this. The message is not shown - and can thus not be selected by the button.

Is there a way to send the above message by button in a Panel?
Thank you!
BR
M.Joerger

K.Wolf
Software Development
Software Development
Posts: 141
Joined: Wed 22. Sep 2010, 15:37

Re: Send message with DLC=0 by Button in Panel

Post by K.Wolf » Fri 22. Oct 2021, 09:51

Hello,

I can see two possible solutions for the problem:

1. Create a dummy signal to your message, e.g.

Code: Select all

Var=Dummy unsigned 0,1
You can assign this signal to your button and set a value when the button is clicked, 0 or 1 for a 1-bit signal. It triggers the sending of your message, and the message has still a DLC of 0.

2. You could use a Standard Macro to send the message. Add a Standard Macro file with the following contents to your project:

Code: Select all

FormatVersion=6.0
Send 1 009033E1h 0
Where 1 is the bus number, and 0 is the DLC.
Then, enter the name of the macro file without the file extension in the 'Execute Command' / 'Befehl ausführen' property of the button.
The only downside of this is that it only works when no other macro is currently running.

m.joerger
Posts: 4
Joined: Fri 22. Oct 2021, 07:52

Re: Send message with DLC=0 by Button in Panel

Post by m.joerger » Fri 22. Oct 2021, 10:38

Thank you for the quick solution!
Creating a dummy signal works for me!
BR
M.Joerger

bkiepke
Posts: 17
Joined: Fri 22. Oct 2021, 13:31

Re: Send message with DLC=0 by Button in Panel

Post by bkiepke » Fri 27. May 2022, 15:43

Is this also possible to do by a .pem? So I do not have to define a lot of standard macros in separate files...

I tried something similar using the following code, the message is sent only once, received continously and the bus gets heavy ...

Code: Select all

Sub LSSMasterSwitchStateGlobalConfigurationState()
	'DESCIPTION: Send LSS Switch State Global Configuring State

	Signals("CANopen_305_LSS.LSS_Master.SwitchStateGlobal.mode").Value = 1 ' will also send the message
End Sub

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

Re: Send message with DLC=0 by Button in Panel

Post by PEAK-Support » Fri 27. May 2022, 16:28

When using a real *.pem (Visual Basic Script based Macro) you simply use the defined Symbol, as shown in the sample from Karlheinz, and use the signalname.Value method.

Code: Select all

FormatVersion=6.0 // Do not edit this line!
Title="Untitled"

{SIGNALS}
Sig="Dummy-Signal" unsigned 1

{SENDRECEIVE}

["Zero-Byte-Symbol-0x200"]
ID=200h
Len=0
Sig="Dummy-Signal" 0
This will trigger the sending of the CAN-ID which is defined in the Symbol of the alligned signal.
You also could send a raw CAN Frame - see samples in the PE6 - using RAW CAN in VBScript, setting DLC to Zero.

If the BUS go into a Error State, have nothing to do with one of the scripts - look like you need a Termination, 2nd ACK CAN Node etc.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

bkiepke
Posts: 17
Joined: Fri 22. Oct 2021, 13:31

Re: Send message with DLC=0 by Button in Panel

Post by bkiepke » Mon 30. May 2022, 06:34

Actually I think that the messages might get corrupted when using the Signals().Value-Method as it seems that this Method may can not wait till the message is sent and the bus is free again.
So to me it looks like "clicking the button" in the intruments panel triggers the sending of the message utilizing the Signals().Value-Method too fast. I could simulate this behaviour by calling Signals().Value multiple times consecutive.

For Example

Code: Select all

Sub LSSMasterSwitchStateGlobalWaitingState()
	'DESCIPTION: Send LSS Switch State Global Waiting State.
	Signals("CANopen_305_LSS.LSS_Master.SwitchStateGlobal.mode").Value = 0 ' will also send the message, may corrupt bus
	Signals("CANopen_305_LSS.LSS_Master.SwitchStateGlobal.mode").Value = 1 ' will also send the message, may corrupt bus
        Signals("CANopen_305_LSS.LSS_Master.SwitchStateGlobal.mode").Value = 0 ' will also send the message, may corrupt bus
	PrintToOutputWindow "Waiting state!"
End Sub
So I need to go with the raw-message example, because at the end, there is a loop which waits for bus free. Surely I could also use a Wait 500 at the end of the Sub, but I guess it may get corrupted in rare cirumstances too.

Post Reply