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
Send message with DLC=0 by Button in Panel
Re: Send message with DLC=0 by Button in Panel
Hello,
I can see two possible solutions for the problem:
1. Create a dummy signal to your message, e.g.
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:
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.
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
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
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.
Re: Send message with DLC=0 by Button in Panel
Thank you for the quick solution!
Creating a dummy signal works for me!
BR
M.Joerger
Creating a dummy signal works for me!
BR
M.Joerger
Re: Send message with DLC=0 by Button in Panel
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 ...
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
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Send message with DLC=0 by Button in Panel
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.
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.
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
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
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
Re: Send message with DLC=0 by Button in Panel
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
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.
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