07-02-2019 01:20 PM
You clearly misunderstood what you need to do. IF a device wants binary data it usually means that it wants an array of bytes that can have the numeric values 0 to 255. It doesn't mean that it wants a string where the bytes has been converted into 0 and 1 characters.
You talk about having to send 35 bytes but really send 280 bytes of data and your device simply sits there and thinks "What the hell are you trying to tell me? Please send something sensible to me!"
Get rid of that entire loop that turns your 35 bytes into 280 characters of 0 and 1s and replace it by a Byte Array to String instead and feed it to the VISA Write function.
And if you are at it, abslutely positively drop that Bytes at Serial Bytes too. It has absolutely no business in this program if you know the number of bytes the answer should be anyhow. Sinply wire that number to VISA Read and use a sensible timeout of maybe 1000 ms. VISA Read will then sit there and wait for the answer until either an error occures, the timeout expires or the number of requested bytes have been received and the entire Bytes at Serial Port is completely unneccessary.
07-02-2019 01:27 PM
You clearly misunderstood what you need to do. If a device wants binary data it usually means that it wants an array of bytes that can have the numeric values 0 to 255. It doesn't mean that it wants a string where the bytes has been converted into 0 and 1 characters.
You talk about having to send 35 bytes but really send 280 bytes of data and your device simply sits there and thinks "What the hell are you trying to tell me? Please send something sensible to me!"
Get rid of that entire loop that turns your 35 bytes into 280 characters of 0 and 1s and replace it by a Byte Array to String instead and feed it to the VISA Write function.
And if you are at it, abslutely positively drop that Bytes at Serial Bytes too. It has absolutely no business in this program if you know the number of bytes the answer should be anyhow. Sinply wire that number to VISA Read and use a sensible timeout of maybe 1000 ms. VISA Read will then sit there and wait for the answer until either an error occures, the timeout expires or the number of requested bytes have been received and the entire Bytes at Serial Port is completely unneccessary.
07-03-2019 08:48 AM
07-03-2019 08:52 AM