Hello,
I'm using PCAN-Explorer 4 in the development of test & diagnostic equipment for automotive ECUs.
I often need to send messages containing one or more counting bytes (I mean a byte where one or both nibbles are cycling...).
In the case it's just one (or both over a limited range...) I use standard macros with a sequence of "send".
Obviously, I can't do that if the counting range is 0x00 - 0xFF.
By now, I'm having that job done directly by the microcontroller on the card under development, but that means a waste of time until the design is not definitive.
I would like the possibility of automating the task in PCAN Explorer, by means o a variable incremented (or decremented) by a certain step each time the message is sent.
I think that's possible in VBS, but I'm not familiar with that language; I'm programming in C.
Is there an example or a template I can adapt to my need?
Thanks for your help....
Cycling bytes
Re: Cycling bytes
Hello,
yes, this will be possible by using a VBmacro. Please have a look on the following demo VBmacro:
regards
Michael
yes, this will be possible by using a VBmacro. Please have a look on the following demo VBmacro:
Code: Select all
'------------------------------------------------------------------------------
'FILE DESCRIPTION: Testmacro
'------------------------------------------------------------------------------
Sub Senddata()
'DESCRIPTION: Send Message with counter to CAN
Dim MySec
Dim client
Dim counter
Set client = PCANClients.Add("Senddata")
client.Device = ActivePCANClient.Device
client.NetName = ActivePCANClient.NetName
Set msg = client.Messages.Add
do
Wait 500
With msg
.id = &H100
.dlc = 8
.MsgType = pcanMsgTypeStandard
.Data(0) = counter
.Data(1) = 0
.Data(2) = 0
.Data(3) = 0
.Data(4) = 0
.Data(5) = 0
.Data(6) = 0
.Data(7) = 0
.Write(0)
End With
counter = counter +1
Loop While 1=1
End Sub
Michael
Re: Cycling bytes
Hi Michael,
Thanks a lot for your prompt reply.
I'll take a look at that macro as soon as I can.
Best regards, and have a nice week-end.
Luca
Thanks a lot for your prompt reply.
I'll take a look at that macro as soon as I can.
Best regards, and have a nice week-end.
Luca