Page 1 of 1

Send message as value of variable

Posted: Mon 8. Dec 2014, 16:36
by omivash
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.

Re: Send message as value of variable

Posted: Tue 9. Dec 2014, 09:49
by omivash
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 ?

Re: Send message as value of variable

Posted: Tue 9. Dec 2014, 10:04
by M.Maidhof
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

Re: Send message as value of variable

Posted: Tue 9. Dec 2014, 11:20
by omivash
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.

Re: Send message as value of variable

Posted: Tue 9. Dec 2014, 11:37
by M.Maidhof
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

Re: Send message as value of variable

Posted: Tue 9. Dec 2014, 11:48
by omivash
Sorry, i have said not distinctly. Actually I used Wait(500) and it still does not work.

Re: Send message as value of variable

Posted: Tue 9. Dec 2014, 13:06
by omivash
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.

Re: Send message as value of variable

Posted: Tue 9. Dec 2014, 14:02
by M.Maidhof
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