PLC-5 N Integer File ASCII Data To String Display
toont said:
...Perhaps direct referencing in String Display doesn't work in this case because length of String is not specified?
Direct referencing should work. Actually, once upon a time it was the only method supported. HMI tags used not be.
As well as the above mentioned, these Technotes, from 2003, say that you cannot use the N File when associating a tag address to a String display or String Input Object...
24651 - String Input and String Display tag address syntax when communicating to SLC or PLC5
Access Level: TechConnect
25921 - N files cannot be used for String Display and String Input Enable objects in FactoryTalk View
Access Level: TechConnect
However, these Technotes, from 2005, now say you can...
32216 - Tag Address Syntax for SLC/PLC5
Access Level: TechConnect
30967 - How to address string tags in FTView Machine Edition from a PLC-5 integer data table
Access Level: TechConnect
It looks like it used not be supported and then it was. So what gives?
Around RSView ME v3.10 or v3.20, the option was added to allow N Files be pointed to as ASCII data locations for the PLC-5 controllers. Also, HMI tags were given support to be used as indirect string data sources.
Where our OP, and perhaps others, were going wrong, was the fact that each 16-bit (N) Integer word stores
two ASCII characters, one in each byte i.e. 1 character = 1 byte.
If you have 10 words of ASCII data stored in an (N) Integer File, say N7:0 - N7:9, that you want to associate with a String Display, to display 10 ASCII characters, then this number of words will actually represent 20 ASCII characters. So setting a word length ",L10" will attempt to read 20 ASCII characters from the 10 (N) Integer words. This will not display as intended.
jasonm said:
...I am trying to pull data from a plc5/25, from N10:0 to N10:9 and display this data in ascii format...I am trying to look at a fixed length of 10 characters...
Each word is not an ASCII character, each byte is. This is incorrectly using 10 Integer words to display 10 ASCII characters. Only 5 Integer words are required.
jasonm said:
...What is the correct syntax to read these tags? Length? Can I use HMI tags or do I need to use direct addressing?...
You can use either direct addressing, or HMI tags.
Example direct address shortcut to read 10 ASCII characters using 5 words; N7:0 - N7:4:
{::[shortcut]A7:0,
L5} (As noted: use A instead of N)
To enter the correct 10 ASCII characters you require, into the 5 Integer words, you change the Radix from Decimal to ASCII for the N File, and enter the 2 ASCII characters required per word, to make up the 10 ASCII characters required in the String Display.
To display the 10 ASCII characters...
"MY_STRING."
Word N7:0 = ASCII MY (Decimal 19801)
Word N7:1 = ASCII _S (Decimal 24403)
Word N7:2 = ASCII TR (Decimal 21586)
Word N7:3 = ASCII IN (Decimal 18766)
Word N7:4 = ASCII G. (Decimal 18222)
Then, in the String Display's Connection tab, use {::[shortcut]A7:0,
L5} to pull in the 10 ASCII characters from N7:0 - N7:4. This is a direct reference to the controller, and should work.
p.s.
jasonm said:
...I changed the syntax to ::[short cut]N10:0
In the string display on the PV+ I get 12366. I still need it to be in ASCII format and for a length of 10.
12366 is the Decimal equivalent of the ASCII characters O & N "ON", which were both stored in N10:0. Using N in the shortcut displayed the Decimal value. This further proves the point that the original 10 characters were indeed stored 2 characters per word.
Regards,
George