LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Communication - Losing data from string

Thanks a lot! I want to try this but am not sure what all those icons are, is it possible to send as a VI? or is there a way to identify all of those operations and icons?

 

Thanks again!

 

Jimmy

0 Kudos
Message 21 of 36
(1,531 Views)

That's a snipette.  just drag it to your desktop then drag it to the an empty block diagram.  Poof!

http://screencast.com/t/unM6ObWPziY1


"Should be" isn't "Is" -Jay
Message 22 of 36
(1,528 Views)

Nice job Jeff.

 

Another example of a poorly written manual.

 

"The checksum is appended to responses as an ASCII representation of a two digit hex number representing a mod256 negated sum of all characters in the response up to and including the comma just prior to the checksum itself."

 

I would interpret that as the response being the entire returned string, which would include the AZ.  (and then leaving off the last two characters that are the checksum since it explicitly excluded them.)  Nothing is obvious in that response that the AZ at the beginning should be excluded as well.

 

It doesn't even make sense that they would drop off just the AZ at the beginning and not also drop off the comma right after that.

0 Kudos
Message 23 of 36
(1,512 Views)

some silly C coding weenie.  "AZ" used as STX, read til port buffer empty, cast to long, Add add to next val =0? at end, OK no err. 

 

(Really you still see some embeded junk like that)


"Should be" isn't "Is" -Jay
Message 24 of 36
(1,506 Views)

Another implementation.  Typecast the value to an I8 so that it can be negated.

 

 

I think their description of "negated" mod256 is kind of confusing.  You really can't negate an unsigned 8-bit integer, when you are actually doing the 2's complement.  (LabVIEW won't wire the negate function to a U8 wire.)

 

Trying to google negated mod256 came up with hits, but none were particularly clear.  Many hits just ignored the negated part and only talked about the mod256.  Googling mod256, and googling 2's complement gave hits that were much easier to figure out what operations they were doing.

Message 25 of 36
(1,498 Views)

Thanks Jeff, I tried implementing that code, but I either did not do it correctly, or am mistaking what is actually happening. I do not get the checksums to agree....I have appended my code and attached a screenshot of my results. Thanks for all your continued help everyone.

Download All
0 Kudos
Message 26 of 36
(1,482 Views)

I am not sure, but am I correct in thinking "Sent" field is what the checksum should be in hex, and that it should match the last two characters in my return string? If so, it always returns FF regardless.

0 Kudos
Message 27 of 36
(1,477 Views)

Toss a "trim whitespace" on that Read Data

(it ends with a \n\r)

Spoiler
Kudos for how I could guess that right.........

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 28 of 36
(1,465 Views)

I'm having troubles now just running my program...I am not sure why...I now receive this error:

 

Possible reason(s):

VISA: (Hex 0xBFFF003E) Could not perform operation because of I/O error.

 

I have attached my code....Thanksfor any help!

0 Kudos
Message 29 of 36
(1,413 Views)

Probably a problem with your serial port.

 

Make sure it still exists in Windows Device Manager.

 

Then check if it exists in Measurement and Automation Explorer.

 

Make sure nothing else is trying to use the port at the same time.

0 Kudos
Message 30 of 36
(1,404 Views)