02-12-2017 02:50 PM
Did this instrument have a library already built on www.ni.com/idnet ?
02-12-2017 08:46 PM
@bockdoug wrote:
After sending them another email asking for a detailed example, I have arrived at what they meant:
Their reply was:
If the message is S3C516467K
S3C5164 – checked part
67 – CRC
K – End of message
- You take the checked part and transfer it from ASCII to HEX
S 3 C 5 1 6 4 =>
0x53 0x33 0x43 0x35 0x31 0x36 0x34
- You do the CRC calculation (in HEX):
0 – 53 – 33 – 43 – 35 – 31 - 36 – 34 = 0xFFFFFE67 = > 0x67
0 – part of the algorithm for the calculation
FFFFFE – carries/borrows
- Transfer the result from HEX to ASCII
0x67 => 6 and 7 => S3C516467K
I followed this and came up with the attached algorithm.
This spits out 4A for my message of "S12" and also gives the correct CRC as in the example above.
Many thanks for all your input.
That's great! Don't forget to mark your post as the solution!
02-13-2017 05:59 AM
Bockdoug
I cleaned up your code slightly. I like to use "String to Byte Array" and auto indexing the loop. Benchmark runs much faster that "Type Cast", especially for large strings (extra buffer allocations??). It probably doesn't make much of a difference for your short command strings though.
crussrulz almost got it right. He just forgot to initialize the shift register to ZERO.
02-13-2017 06:16 AM
@jamiva wrote:
Bockdoug
I cleaned up your code slightly. I like to use "String to Byte Array" and auto indexing the loop. Benchmark runs much faster that "Type Cast", especially for large strings (extra buffer allocations??). It probably doesn't make much of a difference for your short command strings though.
String To Byte Array is literally a no-op since the array and string use the exact same memory structure. The Type Cast does some things to make sure it works.
jamiva wrote:crussrulz almost got it right. He just forgot to initialize the shift register to ZERO.
Actually, I initialized with the first byte and subtract the rest. It was the best interpretation I make from the description given. That is part of the problem with checksums, there are so many ways it can be done and you have to be very clear in describing how it is calculated. Otherwise there is a lot of guess and check.
02-03-2021 12:01 PM
Hi, I guess this is an inductive heating machine (UltraFlex), I am tiring to control it using Matlab; I did the CRC added to the string +K to turn on the heat ('S1249AK'), but nothing happened (the screen on the machine still LOCAL MANUAL). May you share a brief description of who it worked with you, and the codes to achieve that if possible?
02-03-2021 12:11 PM
Hi Assi,
@AssiH wrote:
I guess this is an inductive heating machine (UltraFlex), I am tiring to control it using Matlab;
Then why don't you ask in a Matlab forum? How much information do you expect from some LabVIEW code?
02-03-2021 12:51 PM
Hi GerdW,
I did not ask for the codes in MATLAB, it can be in any programing language, including LABVIEW. I asked about brief description of how the setup with the inductive heating machine work, and this is not a language specific question; it happed that the person that solved this issue, is using LABVIEW.
Best Regards
Assi
02-03-2021 12:56 PM
Hi Assi,
@AssiH wrote:
I asked about brief description of how the setup with the inductive heating machine work,
Which "inductive heating machine (Ultraflex)" are you talking about?
The OP was asking for a (more or less) simple power supply!