03-25-2021 05:49 AM
I use the attached VI to calculate the CRC for the regular 16 Bit parameter value and generate the full command to be transmitted by a Modbus -RTU master.
I now have a requirement to handle 32 Bit parameter for a Bonfiglioli VFD command. The required structure is given below.
Query is whether I can use the same VI to generate the CRC and form the required command by only modifying the 16 bit parameter value to 32 bit parameter value?
Solved! Go to Solution.
03-25-2021 06:50 AM
@MogaRaghu wrote:Query is whether I can use the same VI to generate the CRC and form the required command by only modifying the 16 bit parameter value to 32 bit parameter value?
I don't see how, unless you have the password to that VI.
There should be plenty of CRC for Modbus RTU on the forum... They usually are not password protected.
03-26-2021 01:02 AM
Oh... sorry. Now its opened up !
03-26-2021 02:22 AM - edited 03-26-2021 02:24 AM
Hi MogaRaghu,
@MogaRaghu wrote:
I use the attached VI to calculate the CRC for the regular 16 Bit parameter value and generate the full command to be transmitted by a Modbus -RTU master.
I now have a requirement to handle 32 Bit parameter for a Bonfiglioli VFD command. The required structure is given below.
Query is whether I can use the same VI to generate the CRC and form the required command by only modifying the 16 bit parameter value to 32 bit parameter value?
Your VI currently already calculates the CRC for a 32bit input: the input is just splitted into 2 16bit controls…
See this:
It's the correct result according to your example image!
Right now the problem is to calculate the correct CRC for 16bit input data.
Other problems are all those Rube-Goldbergs in the block diagram…
03-29-2021 06:25 AM
Other problems are all those Rube-Goldbergs in the block diagram…
So bad ?! Well the logic for the CRC calculation was helped by someone here in the forum and I have been using it for long. Never pondered to study / simply it.
Why fix something that is not broke 😄
03-29-2021 07:25 AM
03-29-2021 07:29 AM
@MogaRaghu wrote:
Other problems are all those Rube-Goldbergs in the block diagram…
So bad ?! Well the logic for the CRC calculation was helped by someone here in the forum and I have been using it for long. Never pondered to study / simply it.
I also wander about this.
It's messy (bended wires) but there isn't that much code, and I don't see much that can be done more easily.
03-29-2021 08:21 AM
RubeGoldberg:
03-29-2021 09:01 AM - edited 03-29-2021 09:04 AM
@GerdW wrote:
RubeGoldberg:
- determine last iteration by comparing the loop iterator for "==" when you could check for "<>"
- negating the result of that check using a NOT when you can switch the conditional terminal
- using a while loop when you should use a FOR loop!
That's really one point... If you change the last one, the others simply go away.
Sure some room for improvement.
Let's define Rube Goldberg Code as "exceedingly complex LabVIEW code that perform simple tasks in very indirect and convoluted ways"
It's not that bad.