![]() We need to know exactly what hardware you have. Creating the same question multiple times or creating lots of different questions about the same project is against the forum rules and will incur the wrath of the moderators when they see it. Keeping them together helps get better answers as the answer to one provides the context for the next. ![]() ![]() Also, if you have more than one question but the questions are all about the same project then it is usually preferable to keep the questions in one topic. Some questions might reasonably fit in to more than one category but please do not post the same question in two or more different categories. Choosing the right one is important because not everyone who might be able to help you reads every category. There are lots of different categories to choose from. If English is not your preferred language there are categories in other languagesīelow are some things we need which are often missed by people posting for the first time Without the correct information, it is difficult or impossible to give you the help you need. If you follow these guidelines it helps us to help you and gets your project working quickly. The people who try to help with your project are volunteers doing this for free in their spare time. If you don’t follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is frustrating for you and frustrating for us. Please read and follow the instructions below.īeing new here you might think this is having rules for the sake of rules, but that is not the case. If I remember rightly, the counter must not exceed 7 according to the Deutz document - worth checking this too.This guide explains how to get the best out of this forum. Because the Checksum and counter are separated into the low nibble and high nibble of the 8th byte respectively, you must add them in a binary fashion. The last shift function 'SHR(bMessageCheckSum, 4)' is to move the checksum into the low nibble of 'abPGN0 '.įinally, you must be careful when adding the Checksum to the message counter. The shifting of data after addition is something that is requested by the Deutz documentation and so I cannot explain why this is required, but it is necessary. The last part of the checksum line where the 4 parts of the message ID are added together can be exampled as follows: The '&' signs were replaced with '+' as the statement "& 16#03" is not valid. The documentation is very misleading in places and so I cannot say for sure that the following solution is correct - however, it appears to work well based on testing with an engine on site. The checksum code you have was developed based on documentation from Deutz for their new Stage V engine. Why are we shifting the numbers right and what does this do? Help please! How does that translate into the 16#11, 16#00, and 16#0C numbers? I'm also totally lost on the whole bMessageCheckSum line. I don't understand the terminology of of ID low byte and mid low byte. Which i think just ends up adding a leading 1 to the 3 bit number and will make it a 4 bit number? After that i'm quite lost. That will have an AND mask with the 16#0F number (0000 1111). The message counter is a rotating 0-7 decimal that will be 3 bits. abPGN0 is my 8 byte data array that makes up the data field of the message. I'd would like to actually understand the code I am using however. I was given code for CodeSys of that checksum to beĭwCheckSum :=abPGN0 +abPGN0 +abPGN0 +abPGN0 +abPGN0 +abPGN0 +abPGN0 + (bMessageCounter AND 16#0F) + 16#11 + 16#00 + 16#00 + 16#0C īMessageCheckSum := DWORD_TO_BYTE((((SHR(dwCheckSum,6)) AND 16#03) + (SHR(dwCheckSum,3)) + dwCheckSum) AND 16#07) ĪbPGN0 := SHL(bMessageCheckSum,4) + bMessageCounter Message Checksum = (((Checksum > 6) & 03h) + (Checksum >3) + Checksum) & 07h It is calculated as follows:Ĭhecksum = (Byte1 + Byte2 + Byte3 + Byte4 + Byte5 + Byte6 + Byte7 + (message counter & 0Fh) + message ID low byte + message ID mid low byte + message ID mid high byte + message ID high byte) The message checksum is calculated using the first 7 data bytes, the message counter and the bytes of the message identifier. I'm working with J1939 message TSC1 with validates the data with a checksum and message counter in the 8th data byte. CoDeSys v2.3 on an IFM CR0403 basic controller
0 Comments
Leave a Reply. |