# Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## checksum calculation

Hello Everyone,

At the first picture is my calculation of checksum. And the second one is the rules explained in the manual. I get always get AAH for the same parameter value, that is used here. How is it possible that mannual says that character ¬.

Message 1 of 12
(247 Views)

## Re: checksum calculation

¬ is not the value of the checksum but the symbol used to indicate its position in the command.

Message 2 of 12
(245 Views)

## Re: checksum calculation

The manual is lacking clarity, because e.g. x100 does not even fit into a U8. Also xAA is not the "not" symbol, at least here in the US.

If you want xAA as checksum character, here's one possibility:

It is almost impossible to help you because your code pictures are way too ambiguous. We cannot tell the datatype or display style of any of your constants, and that orange ware definitely has no business here at all!

Message 3 of 12
(229 Views)

## Re: checksum calculation

@altenbach wrote:

If you want xAA as checksum character, here's one possibility:

I can't believe I get to simplify Altenbach's code (it is 95% of the time the other way around)!  There is actually no need to convert to a U16.  You can just subtract from 0x00.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 12
(226 Views)

## Re: checksum calculation

Hello,

Sorry,I have not been clear more. I need to take the parameter 15 as input.  Here is my Vi. I am getting @ as checksum.  The manual is also here. I was following page NO: 02

Message 5 of 12
(221 Views)

## Re: checksum calculation

Your problem is you are mixing the hex value of a character and the value represented in an ASCII format.  They are completely different.  Remove all of those Number To Hex String whatnot from your checksum calculation and fix your value that you are subtracting from.  Your VI can be simplified quite a bit to something like this.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 12
(219 Views)

## Re: checksum calculation

@crossrulz wrote:
I can't believe I get to simplify Altenbach's code (it is 95% of the time the other way around)!  There is actually no need to convert to a U16.  You can just subtract from 0x00.

Ha! So why don't the written instructions not say that instead?? 😄

Message 7 of 12
(203 Views)

## Re: checksum calculation

Thank you everyone.

The checksum error problem is kind of solved. But I still need your help.

Here is what i mean by kind of.

I am trying to send following six commands. I do not get error while sending them individually. Even the command DE,30; as we talked before. But my goal is to send them one after another 6 commands is the order as it is in the VI. and read the VISA read output and save them in a text file.

I have used this loop to do so. But i am always getting the back messege from the machine RR,15; According to Mannual, this means Chekcsum error.

Here is my whole VI and subvis , Is there anything wrong with the way i am using Loop?  DEchecksum is the suvVI for labeled Imax.

Message 8 of 12
(164 Views)
Solution
Accepted by topic author fazlay42

## Re: checksum calculation

Your checksum VI still has weird conversions to and from ASCII.  Get rid of those as it just wastes CPU and memory.

And why are you subtracting 0x100 from your sum before then subtracting from 0x100?  I don't remember seeing that in the manual.

And why are you using a While loop?  Since you have a set number of commands to send, you should be using a FOR loop.

I went ahead and did a bunch of cleaning up of your code.  See if this helps.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 12
(160 Views)

## Re: checksum calculation

Helllo Crossrulz,

Thank you very much, that wokred. I had one more question. I have another machine called autowave. Is it possible to control them both fom same VI? Could you give me any direction?

Best Regards

Message 10 of 12
(136 Views)