Simulation of a CAN node

Comprehensive CAN monitor for Windows® and its add-ins: Plotter, CANdb Import, Instruments Panel, and J1939
Post Reply
lucasclk
Posts: 8
Joined: Wed 25. Sep 2013, 10:46

Simulation of a CAN node

Post by lucasclk » Wed 22. Oct 2014, 12:49

Hallo,

I am currently using PCAN Explorer 5 and would like to simulate a CAN node which will transmit the answer I want everytime a message with certain ID is received.

I would like to do this by using the standard macro but I have no idea if this is possible or how to do it. It will be very helpful if I could get some example/help here.

For example I want to transmit a message with ID 101h everytime i receive a message of 100h.

Thanks

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Simulation of a CAN node

Post by M.Maidhof » Wed 22. Oct 2014, 14:38

Hi,

here the simple macro for that application:

waitid 0 1 100h
send 1 101h 2 AAh 01h
repeat

see help files for more information on how to use those standard macro commands

regards

Michael

lucasclk
Posts: 8
Joined: Wed 25. Sep 2013, 10:46

Re: Simulation of a CAN node

Post by lucasclk » Fri 24. Oct 2014, 11:09

Hallo thanks for the reply and I found out similar examples in the help Content too which helps me out alot.

However I do face another Problem. My code now look like this

FormatVersion=5.0

WaitId 0 1 100h
If True
WaitId 20 1 101h
If False
Send 1 101h 2 00h 00h
Repeat

My aim is to simulate a CAN node to react when a bus in the can network stop answering. So i check if the request (100h) if received, if yes i check next if (101h) is answered, if no the macro shall transmit the 101h message which works perfect with the code above.

My Problem is the node that I want to simulate shall parallel react to not only 100h but also 110h 120h and 130h. Which means if any 110h/120h/130h is received it must check if the correspond answer is available, if yes do nth if no transmit a message. The sequence if 100h or 100h or 120h or 130h is received is completely random and not predictable. Is this Task still be possible to be executed with Standard macro or I need to use the vbscript instead? If so is the command WaitId works in vbscript too?

I would really appreciate for ur help. Thanks

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Simulation of a CAN node

Post by M.Maidhof » Fri 24. Oct 2014, 17:14

Hi,

yes, for complex applications, you should use a VBmacro instead. See WaitForID100 example macro in the macro list for a good startup for your VBmacro.

regards

Michael

Post Reply