LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

checksum

Solved!
Go to solution

Hi

I using a musashi dispenser unit with Rs232 for controller pressure and dispense time. I want to write program in Labview for this. They protocol looklike

DEFAULT is 19200bps.Data Length: 8 bit Start Bit: 1 bit Stop Bit: 1 bit Parity: None Flow Control: None
for instace the Dispense command is stx 04DI_ _(two space) etx
the checksum of this command is CF, which is calculate is 00-30("0")-34("4")-44("D")-49("I")-20("SPACE")-20("SPACE")=CF
can you guys help me calculate this in labview 8.6

thank you very much

0 Kudos
Message 1 of 14
(6,798 Views)

A checksum may be computed in many ways. So refer to you manual. The first step will in almost every case be to use the function below

String To Byte Array Function
Owning Palette: String/Array/Path Conversion Functions
Converts a string into an array of unsigned bytes.
Each byte in the array has the ASCII value of the corresponding character in the string.



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Message 2 of 14
(6,765 Views)

Hi

  coq rouge i konw the step you told me, but i do not konw how to design the whole programme, can you attach a VI for me?

0 Kudos
Message 3 of 14
(6,755 Views)

Generally we teach to fish rather than feeding code.

 

So please post copies of what you have tried and so far so we can help you get that hook tied on the end of the string.

 

Just trying to help,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 14
(6,746 Views)

This is the programme i am using now, but the calculation result is not right when i type 04DI\s\s in the string the result is not CF

0 Kudos
Message 5 of 14
(6,738 Views)

Hi ben

   could you please check the programme for me and point the mistake i should modify

  thanks a lot

0 Kudos
Message 6 of 14
(6,714 Views)
Solution
Accepted by lilight

replace your XOr with a subtract node then swap the two inputs to the subtract node.

 

Note:

 

THe for loop will auto indedx the array if you let it.

 

Or you could

 

String >>> String to byte array >>> Sum Array elements >>> XOr with "FF" then add 1.

 

20617i815FCDF516A93822

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 14
(6,718 Views)

Ben

  i have replace the XOR node to sustract node, but it does not works, the result still wrong

0 Kudos
Message 8 of 14
(6,704 Views)

So now I play a guessing game...

 

Did you swap the two inputs to the subtract as I posted?

 

It worked for me so please try to bait that hook again and again post an IMAGE (down loading on one machine and transfering to another just to look!).

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 14
(6,691 Views)

HI

  i think i get the right reslut, this is the right VI

0 Kudos
Message 10 of 14
(6,689 Views)