03-08-2023 05:55 AM
Good morning,
I trying to use VISA to talk to an IPS power supply.
The communication now works perfectly but I’m struggling to parse the data in a suitable format.
I require just the voltage output but it seems to be interspersed with zeros.
Any suggestion as to how I overcome this issue.
Thanks
Solved! Go to Solution.
03-08-2023 07:32 AM
Hello, Simon-lee. I see that you got @crossrulz, the Forum's expert on all things Serial, to help you with the VISA side of communication with the IPS-603. What might (?) now be happening is that you are getting responses back, but maybe are parsing the returning data incorrectly.
Here's my suggestion: Make a copy of your Volt-Read program. Delete the While Loop (so you only do one read), and delete everything below the Error Line (no parsing). Attach a String Indicator to the Read Buffer Output, set its "Appearance" Property to "Backslash Code" (so we can see \13 and \10, if present), and run the Program. Expand the String Indicator so we can see the entire String. Note that if it doesn't "look like a String", you might need to connect a "String to Byte Array" function to the Read Buffer output and display (perhaps in Hex) the resulting Byte Array.
One other thing to try is to see if things work better if you use <LF> (0x10) instead of <CR> (0x13) as the VISA termination character.
Sometimes just seeing how the data actually look can be a great help! Since it is either going to be a readable (I hope) String or a short list (50 elements, at most) of U8s, you can even attach a "picture" (I know, I usually cry when pictures are attached) and I'll be happy ...
Bob Schor
Could you take the output of your VISA Read (of 50 characters) and save it as a String Indicator? Set the "Appearance" Property of this Indicator to "Backslash Codes" (so we can see \13 and \10, if they are present) and can see all the other characters in the String. For the purposes
03-08-2023 09:03 AM
Do you have a link to the manual? We need a lot more information on how the messages and replies are formatted in order to give any real advice.
03-08-2023 09:17 AM
Hi Bob Schor,
Thank you for you interest, Yes @crossrulz was a massive help.
I have added some addition snips - one with the original termination character - and a second with no termination.
On you second suggestion of subsituting <LF> for <CR> I returned to my original vi and made the change. Hey presto it works, I really happy it works. I have also added some additional HEX and \ codes if that might explain why.
I can now keep my project moving and a bit shout out to you and crossrulz, your help and advice is much appreciated.
Regards
03-08-2023 09:27 AM
Hi Crossrulz,
I have attached the manual , I had a responce fron Bob Schor and acting on his suggestion I repaced the <CR> with <LF> and that appears to work. I.m not sure why as your solution was correct to the printed manual but I have a working solution. I would like to thank you for all of your advice and support.
Regards
03-08-2023 09:32 AM - edited 03-08-2023 09:37 AM
I find it weird there are two Carriage Returns. It is like the supply is terminating the response with just a Carriage Return (which is why I previously told you to use that as the termination character) and then appending a Carriage Return and a Line Feed to complete the message. Therefore, you should be using the Line Feed as the termination character.
EDIT: From the Manual
"The power supply has 25 commands available. Every command is end up with (ASCII 0Dh or ACSCII 0D 0A acceptable). The return message of the power supply is CR/LF (ASCII 0D 0A)."
03-08-2023 10:42 AM
@crossrulz wrote:
I find it weird there are two Carriage Returns. It is like the supply is terminating the response with just a Carriage Return (which is why I previously told you to use that as the termination character) and then appending a Carriage Return and a Line Feed to complete the message. Therefore, you should be using the Line Feed as the termination character.
EDIT: From the Manual
"The power supply has 25 commands available. Every command is end up with (ASCII 0Dh or ACSCII 0D 0A acceptable). The return message of the power supply is CR/LF (ASCII 0D 0A)."
Whenever I see weird stuff like this, it makes me think that the communication was originally intended to be used with a terminal program, and someone made a hasty adaptation (or sometimes even NO adaptation) to automate it.
03-09-2023 04:30 AM
Hi Crossrulz,
I've punched in some of the commands with the following outputs.
V\r = V23.28\r\r\n
L\r = V23.28A0.000W000.0U60I2.11P127F000010\r\r\n
V\r = V23.28\r\r\n
A\r = A0.000\r\r\n
W\r = W000.0\r\r\n
U\r = U60\r\r\n
F\r = F000010\r\r\n
All have that odd double \r - I guess its just one of those undocumented idiosyncrasys. It was a cheap unit and its quite slow responding (baud rate is only 2400) so you get what you pay for. On the plus side I can talk to it now, thanks to you and others on this forum.