Toggle bit in macro

Comprehensive CAN monitor for Windows® and its add-ins: Plotter, CANdb Import, Instruments Panel, and J1939
Post Reply
Stefano Mossina
Posts: 1
Joined: Wed 18. Nov 2020, 11:06

Toggle bit in macro

Post by Stefano Mossina » Wed 18. Nov 2020, 11:15

Hi all,

I am controlloing an inverter with a CAN message. The message should include a toggle bit (which is toggled at every new message sent). I tried to this in two ways:

1) Define a message in my TransmitList with 100ms timer and use a macro to insert the toggle bit.
2) Use a macro toggling the bit and sending the message automatically.

Both my macros use the instruction "Wait 100" in an endless while loop to time, respectively, the bit toggling and the message sending.

With method 1) I encounter the issue that the macro in not synched with the transmit list and this results in the bit not getting toggled at some random point in time
With method 2) I encounter the problem that if I do something else on my laptop the macro gets stuck for a while and the message is not sent in 100ms (and timeout occurs on inverter).

My question is: how can I synch the macro with the transmit list? I mean, when the transmit list is "building" the message to be sent, I want my macro to jump into there and insert the correct toggle bit.
Alternatively, I can I perfectly time the macro and its message sending with my laptop system time?

Basically I would like my macro to be executed as "compiled code" by my laptop's microprocessor and not as an "interpreted" code run over system time..

Is that possible?

Thanks for your answers!

User avatar
U.Wilhelm
Sales & Support
Sales & Support
Posts: 1190
Joined: Fri 10. Sep 2010, 19:34

Re: Toggle bit in macro

Post by U.Wilhelm » Wed 18. Nov 2020, 14:19

A combination of sending with a Transmit List and a script is not possible because you could not sync both events.
You need to send the message only from the VBS script - that should work. In PE6 we offer a callback lib which is the better solution. But PE5 is out of maintance.
--------------------------------
PEAK-System Technik
Technical Support Team
support@peak-system.com
-------------------------------

Post Reply