Send message as value of variable

Comprehensive CAN monitor for Windows® and its add-ins: Plotter, CANdb Import, Instruments Panel, and J1939
Post Reply
omivash
Posts: 5
Joined: Mon 8. Dec 2014, 15:16

Send message as value of variable

Post by omivash » Mon 8. Dec 2014, 16:36

Hi to all,

i am trying to realize something like actuator simulator, which answers with "Real Position" after becoming the desired "setpoint". So my PCAN-Explorers application has to send a variable, which is equal to an other received earlier. I have prepared one variable for receiving and one for sending. But have no idea how to impart received value to sending variable.
I suppose that it should be not a very difficult task but still can not find the answer.
Could you please give me any hints or links to other topic, where any similar task was solved.
Thanks in advance.

omivash
Posts: 5
Joined: Mon 8. Dec 2014, 15:16

Re: Send message as value of variable

Post by omivash » Tue 9. Dec 2014, 09:49

So, as far as i understand now, it is possible to manipulate variables in VBS-macroses, and to register becoming the desired message from standard macros. But not clear how to start VBS-macros from standard macros when the desired message is received. Is it possible in general? Or there are any other methods to trigger the VBS-macros start ?

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Send message as value of variable

Post by M.Maidhof » Tue 9. Dec 2014, 10:04

Hi,

you cannot start a VBmacro from a standard macro. Please only use a VBmacro for your task. Here a link to another thread, in which you will find a VBmacro which will calculate variables in a timer loop:

http://www.peak-system.com/forum/viewto ... p=421#p421

regards

Michael

omivash
Posts: 5
Joined: Mon 8. Dec 2014, 15:16

Re: Send message as value of variable

Post by omivash » Tue 9. Dec 2014, 11:20

Thanks for reply,
but i've tried using Wait() in endless loop and it does not work. The PCAN-Explorer hangs and i've got the next message: "The script you are executing is taking longer then expected to run. Click End ..."

It seems like the Wait() can not prevent 100% CPU load. Or i have to start the macros in a different way.

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Send message as value of variable

Post by M.Maidhof » Tue 9. Dec 2014, 11:37

Hi,

Wait() always needs a number for the milliseconds to wait, like Wait(10) or Wait(1), please see help for more details

regards

Michael

omivash
Posts: 5
Joined: Mon 8. Dec 2014, 15:16

Re: Send message as value of variable

Post by omivash » Tue 9. Dec 2014, 11:48

Sorry, i have said not distinctly. Actually I used Wait(500) and it still does not work.

omivash
Posts: 5
Joined: Mon 8. Dec 2014, 15:16

Re: Send message as value of variable

Post by omivash » Tue 9. Dec 2014, 13:06

I have found a similar problem, that seems to be solved by means of PCAN-Basic API.
http://www.peak-system.com/forum/viewto ... =50&t=1125

Could you please give me any hints, how to start its studding and using for PCAN-Explorer. Is there any description.

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Send message as value of variable

Post by M.Maidhof » Tue 9. Dec 2014, 14:02

Hi,

PCANBasic API is an API to build own applications with a compiler. But you can´t use this API from a PCAN-Explorer macros.

regards

Michael

Post Reply