How to Learn and Improve CAPL Programming Ability

CAPL is a process-oriented language developed by Vector Corporation to cooperate with its series of products. CAPL is the abbreviation of Communication Access Programming Language . Literally speaking, it is a programming language specially used for communication access.

Initial access to the CAN bus has now been extended to all automotive bus systems such as LIN, FlexRay, MOST, J1587, Ethernet, and some others such as ARINC and CANopen.

The CAPL language is a C-like language, and the C language is a procedural language, so CAPL is also process-oriented, not object-oriented. The execution of the function body in CAPL is triggered by an event, for example, when the key 'a' is pressed, the execution of the function body of on key 'a' is triggered. CAPL programs are developed and compiled in the special editor "CAPL Browser", so objects and variables in various types of databases can be directly accessed, such as messages, signals, system variables and diagnostic service objects.

The goal of CAPL has always been to solve specific tasks as simply as possible. Typical tasks are reacting to received messages, checking and setting signal values, and sending messages.

The following code is implemented:

  1. Observe the elements of a CAN network (described in the database), such as bus nodes, messages and transmitted signals.
  2. When an EngineState message is received, the EngineSpeed ​​signal it contains is set to display on the display panel.
  3. When a LightState message is received, the HeadLight and FlashLight signals it contains will be synchronized to the panel for display.
variables
{
  const long                kOFF = 0;
  const long                kON = 1;
}

on message EngineState
{
  @sysvar::Engine::EngineSpeedDspMeter = this.EngineSpeed / 1000.0;
}

on message LightState
{
  if (this.dir == rx)
  {
    SetLightDsp(this.HeadLight, this.FlashLight);
  }
  else
  {
    write("Error: LightState TX received by node %NODE_NAME%");
  }
}

void SetLightDsp(long headLight, long hazardFlasher)
{
  long          tmpLightDsp;
  
  tmpLightDsp = 0;
  if (HeadLight == kON)
    tmpLightDsp = 4;
  if (hazardFlasher == kON)
    tmpLightDsp += 3;
  @sysvar::Lights::LightDsiplay = tmpLightDsp;
}

As can be seen from the above introduction and code:

The CAPL language is quick for those who are familiar with the C language. For those who have never been exposed to programming, or who have only learned Python, there is a learning process in grammar. After all, one is a compiled language and the other is an interpreted language; one is a strongly typed language and the other is a weakly typed language. My experience is that you can learn and understand the C# language first. First of all, the C# language has certain advantages in Windows Forms, which may be used in the future. Moreover, the C# language is derived from C and C++. You can also regard CAPL as a C#-like language. After learning C#, you will quickly get started with CAPL.

As a niche language that serves Vector products and is used in specific scenarios, CAPL is doomed to not have many learning materials, let alone a large number of third-party libraries like Python. This has caused it: it is difficult to get started if you want to learn, it is difficult to go deep if you want to be proficient, and it is difficult to solve problems when you encounter problems.

Due to the lack of support of third-party libraries in the CAPL language, you want to implement many functions. For example, when processing certain data, you need to write basic functions yourself.

The official Help document provides the necessary content of CAPL, but due to its full English interface and complicated content, sometimes it is really difficult to find what you want.

Although the CAPL language is small, because it serves Vector products, you also need to learn to use tools such as CANoe. Since it is used to access the car bus, you also need to know various bus protocols: CAN bus, LIN bus, Flexray bus, Ethernet bus, TCP/IP protocol, UDS diagnostic protocol, DoIP protocol, SOME/IP protocol, AVB protocol, etc. It's really one head and two big! ! !

However, with the rapid development and intensified competition of the domestic automobile industry, the requirements for automobile practitioners, especially testers, are getting higher and higher. The functional testing post already requires proficient use of CANoe and the ability to write in CAPL language. Do not believe? Just open a job site to see.

Roll it, roll it to death!

Now that it's so full, let me add another fire: "CAPL Programming Language" The second phase of the registration is now open! ! !

More than 30 hours of live video, with the CAPL language as the theme, and practical code operations, from easy to difficult, in-depth and interlocking. Comprehensively expand the knowledge beyond CAPL, grasp the details and underlying logic. Clear the fog and see the essence clearly.

Not only here:

  • Introduction to basic concepts, grammar, and commonly used functions of CAPL
  • Precautions in the use of CAPL
  • CAPL Advanced Tutorial

besides:

  • The function introduction of CANoe, including: software installation, environment configuration, panel design, diagnostic communication, etc.
  • Computer data storage, memory alignment, endian conversion, etc.
  • DBC, CDD database file introduction
  • Autosar Network Management Analysis
  • Detailed explanation of full functions of UDS diagnostic service
  • Introduction to Ethernet TCP/IP Protocol

Moreover:

  • After-class exercises and explanations for multiple chapters
  • 20 basic knowledge multiple-choice questions and explanations
  • Network management, DTC diagnosis and other exercises and explanations

Since most of the places are reserved by acquaintances, there are only a few places at present. If you are interested, add me on WeChat to register!

Attached syllabus:

CAPL programming language


Guess you like

Origin blog.csdn.net/wjz110201/article/details/131418223