Reading latest signal-values by macro

Comprehensive CAN monitor for Windows® and its add-ins: Plotter, CANdb Import, Instruments Panel, and J1939
Post Reply
mulan_nl
Posts: 1
Joined: Thu 14. Mar 2013, 16:19

Reading latest signal-values by macro

Post by mulan_nl » Thu 14. Mar 2013, 16:59

Hello,

Currently, I am reading the latest message value by using:

Code: Select all

signal_name.MessageToValue(msgs(msgs.Count-1))
which parses through the entire received messages buffer, which is quite slow.

1. Is there another way (macro?) to receive the latest message signal information only?
I am using Set msgs = trc.Messages.FindSymbol(sym) to link the new messages each time. (this could may be the cause of the delays)

2. Is it also possible during 'live' mode, i.e. when a connection is made using Connections.ReceiveMessages?

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

Re: Reading latest signal-values by macro

Post by PEAK-Support » Fri 15. Mar 2013, 09:51

When you work with Signals, you do not need to iterate to the Message queu. The Signal will always have the lates value. Means, if your Signal is defined as a Bitsection of a incomming CAN Frame, you only need to read the Signal.Value and you have the latest value. Attached a simple project that use a Symbol File that define 2 Signals based on a CAN Frame and use them to calculate a third, virtual, Signal.
Attachments
Power.zip
power calculating sample project for PE5
(3.73 KiB) Downloaded 436 times
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Post Reply