This is a follow on from a question I asked some time ago relating to the creation of a sequence and CRC in a dynamically changing message. The original post was here: http://www.peak-system.com/forum/viewto ... =50&t=1237
The code you suggested is shown below:
Code: Select all
Sub SendMessage()
Dim sequence, sig1, sig2, crc
Set sequence = Signals("SequenceNumber")
Set sig1 = Signals("Sig1")
Set sig2 = Signals("Sig2")
Set crc = Signals("CRC")
' Disable AutoTransmit option of variables
sequence.Source.AutoTransmit = False
sig1.Source.AutoTransmit = False
sig2.Source.AutoTransmit = False
sequence.Value = 0
While True
sequence.Value = sequence.Value + 1
crc.Value = 123 ' calculate and assign CRC value here
Wait 100
Wend
End Sub
If I have a signal (for example the CRC), how can I navigate to the message it is in and access the other bytes of the message? I don't really want to have to mask off bits and bytes of signals because this is very unmaintainable although if there is no alternative I suppose it is possible.
I think I may be able to get at the contents via Connections.TransmitMessages().DataVariant but I can't work out out how to get this back as an array.
Any help would be gratefully appreciated.
Thanks,
Richard
P.S. Is there any better way of debugging VBScript in PCAN Explorer other than by using PrintToOutputWindow()?