Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

checksum calculation

Solved!
Go to solution

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 ¬.

Thanks in advance.

Download All
0 Kudos
Message 1 of 12
(246 Views)

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

0 Kudos
Message 2 of 12
(244 Views)

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:

 

altenbach_0-1634033349447.png

 

 

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!

 

0 Kudos
Message 3 of 12
(228 Views)

@altenbach wrote:

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

 

altenbach_0-1634033349447.png


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.


GCentral
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
0 Kudos
Message 4 of 12
(225 Views)

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

 

Thanks in advance.  

Download All
0 Kudos
Message 5 of 12
(220 Views)

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.


GCentral
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
Download All
Message 6 of 12
(218 Views)

@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?? 😄

0 Kudos
Message 7 of 12
(202 Views)

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.

 

 

Download All
0 Kudos
Message 8 of 12
(163 Views)
Solution
Accepted by fazlay42

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.


GCentral
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
0 Kudos
Message 9 of 12
(159 Views)

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

0 Kudos
Message 10 of 12
(135 Views)