overviewPreface
Previously we came out on the TSMaster application notes series of several articles, partners feedback are very practical, but also engineers in the use of TSMaster software in the practical problems that will be encountered, today continue to bring you the application notes series of articles - how to code automatically send LIN messages.
Table of Contents for this article
I. Hardware preparation
Use the virtual LIN device that comes with the TSMaster software as an example to demonstrate how to send and receive LIN messages using C scripts.
1|Channel Selection
Click Hardware - Channel Selection in the menu bar and the following window will pop up:
2|Configuration Environment
Select the number of application LIN channels and LIN hardware channels according to your needs. Here, we do not use LIN hardware, so we select the virtual channel for the demonstration, and we can only send messages under the virtual channel (after connecting the LIN hardware, follow this procedure), and click OK.
II. Simulation
Open the simulation window and use the C code editor to edit the telegram code.
1|Click Add C Script Editor
1-1 Creating a New Shortcut Event
Mouse over the shortcut event, right click, add a shortcut event, enter a custom shortcut key; for example, "A".
1-2 Code Writing
Write the code message to be sent under the added shortcut key event screen, for example:
1-3 Selecting the Message Writing Method
The above describes two ways of writing LIN messages, which are chosen by the user.
III. Viewing Message Information
1|View Message Information Screen
Under the Analyze menu bar, check the Message Information option and right-click Add LIN Message Information to view LIN message information through this screen.
2|Download Scheduler
Under the Analyze menu bar, check Message Sending and add LIN Sending, and through this window, download the LIN scheduling table.
3|Setup Self-Start
Set all of the above interfaces that support self-start to self-start, click the lightning bolt icon in the upper-right corner of the interface to set it. Auto-start means that all the interfaces that are set to self-start will run automatically when you click Start in the analysis form.
4|Operation Engineering
In the Analyze window, click Start, and then type "A" on the keyboard. The system message will display the information from the log function, and the LIN message information screen will show the message information to be sent and received. Note that the virtual channel used here can only send TX messages, but if the virtual channel is switched to LIN hardware, the message with identifier 3D will be the receive message RX.