Created another modbus query to retrieve the software version running on the device.
The decimal values returned are as follows,
50 46 48 51 70 50 50
Converted to ASCII would represent the following,
2 . 0 3 F 2 2
How do I, firstly get it converted and secondly in a usable string format for IA designer?
Strings are a bit tricky. There no good way to do it from the browsable tags (well, there is, but it’s really tedious ). You can however directly set up a MODBUS string directly from within the SQLTag.
Example: [DeviceName]HRS1024:20 Read 20 character string value starting at Holding Register 1024.
In your case, it would be closer to: [DeviceName]HRS1:7
Use this format in place of the browsable name you would normally use.
Hope this helps!
I’ve been racking my brain trying to figure out how to add the SQLTag … urgh
Would I be adding it using the SQL Tag Browser in Ignition designer or somewhere is the configuration section?
Yep! Add the tag using the SQLTag Browser in the Designer. Here’s an example of directly addressing in MODBUS:
[attachment=0]11-8-2013 11-28-15 AM.png[/attachment]
Note how my item is configured in the OPC Item Path.
Fantastic - thank you for explaining that to me …
Now, when I use [Emerson]1.IR1 it returns 50, but when I use [Emerson]1.HRS1 it returns no value.
[Emerson]1.HRS1:7 also returns no value …
Did you set your datatype to string?
Something that just occurred to me. I don’t think it’s going to work. 16-bit registers will hold two characters of ASCII data. Each register you show has one character data in it. the High byte would be null, which would certainly explain the ‘no value’ that you’re getting.
Don’t get me wrong. If I’m pleasantly surprised and it works without issue, then great! Otherwise, it gets a little more involved:
Solution forthcoming. Stay tuned…
OK, here goes…
I set up some tags to simulate the incoming OPC values: SW_Ver (1) through SW_Ver (7)
[attachment=0]11-11-2013 2-30-45 PM.png[/attachment]
Then I set this code into a gateway Timer Script running every second for testing. Really, you could probably set it to a lot longer if the value isn’t going to change often.
[code]#List of tags to Read
tags=[‘Test/SW_Ver/SW_Ver (1)’,‘Test/SW_Ver/SW_Ver (2)’,‘Test/SW_Ver/SW_Ver (3)’,‘Test/SW_Ver/SW_Ver (4)’,‘Test/SW_Ver/SW_Ver (5)’,‘Test/SW_Ver/SW_Ver (6)’,‘Test/SW_Ver/SW_Ver (7)’]
#Grab Values of the Tags
#Create an empty string
for i in range(len(tags)):
#Concatenate the ASCII values together
#Write final concatenated value out to a tag
One thing to note: I’m running 7.2 and the function names have changed a bit. Even though they’re deprecated, they’ll probably still work. But you should make the following changes: