You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old June 10th, 2011, 05:39 PM   #1
JeffKiper
Lifetime Supporting Member + Moderator
United States

JeffKiper is offline
 
JeffKiper's Avatar
 
Join Date: Jun 2006
Location: Indiana
Posts: 2,157
ASCII long unproductive day

OK I just found a Inline Indirection in the RS500 instruction set. This allows you to insert integer and floating point values into ASCII strings.

I have been trying to write code to convert a Float to a String AND handle any errors that I get because of math overflows. So after a full day of nothing but junk code I found this.
If you are doing ASCII this might help

Flow rate is currently [N7:0] GPH and contains [F8:0] PPM contaminants.

Keywords to search for later when I can't find this
float to string
F to ST
__________________
There should be a minimum IQ before people can breed.

FS Eng (TÜV Rheinland, #11004/15, Machinery)
  Reply With Quote
Old June 11th, 2011, 05:42 AM   #2
OkiePC
Lifetime Supporting Member
United States

OkiePC is offline
 
OkiePC's Avatar
 
Join Date: Mar 2005
Location: ENE of Nowhere Oklahoma
Posts: 9,681
http://www.plctalk.net/qanda/showthread.php?t=29897
__________________
It's not all the variables I am most concerned with, it's the undiscovered constants.
  Reply With Quote
Old June 11th, 2011, 09:41 AM   #3
bernie_carlton
Lifetime Supporting Member + Moderator
United States

bernie_carlton is offline
 
bernie_carlton's Avatar
 
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 6,203
The "in-line" indirection appears to be interpreted at the time of execution for transmitting a string out the serial port (AWA, AWT).
__________________
Controlling outputs is the PLC's way of getting its inputs to change.

www.thePLCguy.com
  Reply With Quote
Old June 11th, 2011, 09:51 AM   #4
JeffKiper
Lifetime Supporting Member + Moderator
United States

JeffKiper is offline
 
JeffKiper's Avatar
 
Join Date: Jun 2006
Location: Indiana
Posts: 2,157
That is what it looks like. I have to send a float out a string. So this may just be my answer to eliminate the error handling. I was going to convert from float to integer then concantinate whole number decimal then fractional. Asking as the word was under 32767 I was OK. You all know how much fun this gets to be without loosing accuracy.
__________________
There should be a minimum IQ before people can breed.

FS Eng (TÜV Rheinland, #11004/15, Machinery)
  Reply With Quote
Old June 11th, 2011, 12:41 PM   #5
OkiePC
Lifetime Supporting Member
United States

OkiePC is offline
 
OkiePC's Avatar
 
Join Date: Mar 2005
Location: ENE of Nowhere Oklahoma
Posts: 9,681
Okay, guys, help me understand this "inline indirection" thingy you discovered. I found a mention in RSLogix500 help, but I still don't know what they're talking about.
__________________
It's not all the variables I am most concerned with, it's the undiscovered constants.
  Reply With Quote
Old June 11th, 2011, 12:44 PM   #6
JeffKiper
Lifetime Supporting Member + Moderator
United States

JeffKiper is offline
 
JeffKiper's Avatar
 
Join Date: Jun 2006
Location: Indiana
Posts: 2,157
Paul imbed a variable in a string.
This way you don't have all the headache of conversion.
I have inserted variables in pb32 text but didn't know I could use them in a string 500
__________________
There should be a minimum IQ before people can breed.

FS Eng (TÜV Rheinland, #11004/15, Machinery)
  Reply With Quote
Old June 11th, 2011, 12:46 PM   #7
OkiePC
Lifetime Supporting Member
United States

OkiePC is offline
 
OkiePC's Avatar
 
Join Date: Mar 2005
Location: ENE of Nowhere Oklahoma
Posts: 9,681
Quote:
Originally Posted by JeffKiper View Post
Paul imbed a variable in a string.
How?

(I am especially dense this week.) Got any examples you can share?
__________________
It's not all the variables I am most concerned with, it's the undiscovered constants.
  Reply With Quote
Old June 11th, 2011, 12:47 PM   #8
bernie_carlton
Lifetime Supporting Member + Moderator
United States

bernie_carlton is offline
 
bernie_carlton's Avatar
 
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 6,203
In a string you wish to transmit using AWA or AWT you can bury within that string references to values in the data table. The string: (assuming the contents of N7:0 is 25)

"The value of N7:0 is [N7:0]"

When transmitted will be:

"The value of N7:0 is 25"

So you won't see the string IN THE PLC as expanded with the value, only in the string which is actually transmitted. It won't help if you are trying to create a string version of a float where the string version will exist in the PLC.

You can use any data table item in the string as long as it exists and is within the brackets. Even a float type. But I think you have been referring to trying to do a Float -> String type instruction where the final string exists in the PLC.
__________________
Controlling outputs is the PLC's way of getting its inputs to change.

www.thePLCguy.com

Last edited by bernie_carlton; June 11th, 2011 at 12:50 PM.
  Reply With Quote
Old June 11th, 2011, 12:50 PM   #9
JeffKiper
Lifetime Supporting Member + Moderator
United States

JeffKiper is offline
 
JeffKiper's Avatar
 
Join Date: Jun 2006
Location: Indiana
Posts: 2,157
ST9:0 "just add in the brackets [N7:0]"
That would be sent out the port in a AWA. just add in the brackets 32767
Try it out. I may have new alarm setup.
__________________
There should be a minimum IQ before people can breed.

FS Eng (TÜV Rheinland, #11004/15, Machinery)
  Reply With Quote
Old June 11th, 2011, 12:50 PM   #10
OkiePC
Lifetime Supporting Member
United States

OkiePC is offline
 
OkiePC's Avatar
 
Join Date: Mar 2005
Location: ENE of Nowhere Oklahoma
Posts: 9,681
Thanks, Bernie, Jeff. So all you need is the "[" and "]" symbols and a valid address...very cool. I rarely write out of a serial port, but I will remember this next time I need it.
__________________
It's not all the variables I am most concerned with, it's the undiscovered constants.
  Reply With Quote
Old June 11th, 2011, 01:56 PM   #11
JeffKiper
Lifetime Supporting Member + Moderator
United States

JeffKiper is offline
 
JeffKiper's Avatar
 
Join Date: Jun 2006
Location: Indiana
Posts: 2,157
OK guys the MLX 1100 does NOT support Floating points in the inline indirections. SO back to old school ways but at least it does support Longs. SO I should be able to take the float find the decimal position and convert it into 2 longs. Then imbed the Longs in the String and send them. I hope
__________________
There should be a minimum IQ before people can breed.

FS Eng (TÜV Rheinland, #11004/15, Machinery)
  Reply With Quote
Old June 11th, 2011, 03:25 PM   #12
JeffKiper
Lifetime Supporting Member + Moderator
United States

JeffKiper is offline
 
JeffKiper's Avatar
 
Join Date: Jun 2006
Location: Indiana
Posts: 2,157
OK I am back where I started. I am looking for a way to handle Floating points what can vary. I looked at Paul's example but what happens if the number varies from -1.0 to -0.00009 I need some logix that can handle those swings in numbers.
__________________
There should be a minimum IQ before people can breed.

FS Eng (TÜV Rheinland, #11004/15, Machinery)
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
day of week joejoe LIVE PLC Questions And Answers 24 November 8th, 2017 04:19 PM
Convert a register binary value to ascii mrtweaver LIVE PLC Questions And Answers 15 May 22nd, 2007 08:24 AM
Texas ascii message card jed LIVE PLC Questions And Answers 5 August 1st, 2006 04:36 PM
ascii read sheirj LIVE PLC Questions And Answers 2 February 9th, 2006 01:19 PM
How to calculate the day of the week? sparky64 LIVE PLC Questions And Answers 20 April 26th, 2004 03:42 PM


All times are GMT -5. The time now is 11:00 AM.


.