Site Information

 Loading... Please wait...

Programming the SAE J1939 ECU Simulator Board Using Visual Studio C#

Posted by Wilfried Voss on

jCOM C# Demo Code Window Screen Shot

The following refers to a Visual Studio C# application, representing a very simplified version of our jCOM1939 Monitor - SAE J1939 Monitor, Analyzer, And ECU Simulator. The jCOM1939 Monitor Software is a tool to monitor, analyze, and simulate SAE J1939 data traffic. The system combines our jCOM.J1939.USB that functions as an SAE J1939 to USB (or UART) gateway. A comprehensive and easy-to-use, easy-to-understand Windows software displays not only SAE J1939 data traffic; it also allows to scan the network, simulate an ECU (incl. full node address negotiation features), and respond to data request messages.

It is important to point out that you will need our jCOM.J1939.USB gateway for both program versions, the demo code and the actual monitor program, to work. Also, both programs will work only with our gateway; they are not designed to work with any other hardware by other manufacturers.

In contrast to the full monitor software, the demo program, as introduced in the following, is available in full source code. The C# code was developed using Visual Studio 2013.


The first step of handling the software is to select the COM port that was assigned to the gateway. The program offers choices by scanning the PC for available COM ports. After selecting the right COM port and clicking the Start command button, you will see the heartbeat messages appearing on the screen. The gateway sends the heartbeat message every one second.

Clicking on the Request Status will provide a feedback such as REPSTATUS - Listen-Only Mode, indicating that the gateway will only receive SAE J1939 PGNs and display them. However, be aware that you will need to set a PGN filter for data to be displayed. That PGN filter is hard-coded as 65280, but can be modified to any other PGN.

Use the Add Filter command button to add the filter and Delete Filter to remove it.

In order to transmit data into an SAE J1939 network, you will need to claim a node address. This is accomplished by clicking Claim Address. Please be aware that you will need at least one other network node to establish communication, otherwise the address claim will fail.

After the node address has been claimed successfully, you will be able to transmit data into the network. Yet again, all parameters such as desired node address and the transmitted data are hard-coded into the program but can be easily modified. After all, the code is designed to demonstrate the communication between the gateway and the PC.

C# Source Code

I will not engage into a detailed description of the source code, since this would require some tremendous efforts and time. Every programmer will some basic C# experience will be able to recognize the important parts and I have tried to keep the program as simple as possible. The code explains the most important commands to the gateway and how to receive feedback and data.

However, in order to understand the protocol between the gateway and the PC, you will need to read our document (PDF):