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 July 5th, 2006, 02:12 PM   #1
maverick2986
Member
United States

maverick2986 is offline
 
Join Date: Jul 2006
Location: Murfreesboro
Posts: 2
Fancy Exclamation RSLOGIX 500 Decimal to Hex

Hello,

I'm currently working on a vision system project where a camera takes a stored image of a pattern and compares it to an image just taken via a trigger (in this case sent from the PLC) and calculate the offset (X, Y in units of pixels; R in degrees). This ASCII string is then read into the PLC. I then "chop it up" into separate ASCII strings to extract the X, Y, and R from the data string. This then get concatenated with a transmission start code ($) along with a few other things and sent to a robot to calculate the offset before moving. I have the format roughly down, however I do have two problems. 1) The string output must be in Hex format so a "-2300" must be output as "FFFFF704". I have no idea of how to do this conversion. Even if I were to convert the ASCII value to an integer, how would I be able to then go ahead and convert it back into an ASCII value but in Hexadecimal format? 2) Many times the offset value is rather large and would probably cause an overflow if I were to convert the ASCII value to an integer. I thought about converting it to a Float but could not find an instruction for ASCII to FLOAT conversion.

Any help would be appreciated. Thank you.

Brian
  Reply With Quote
Old July 6th, 2006, 06:52 AM   #2
Doug-P
Member
United States

Doug-P is offline
 
Doug-P's Avatar
 
Join Date: Jun 2003
Location: Pa
Posts: 702
There are instructions to convert ASCII to integer (ACI) and vice versa (AIC). As long as the values don't exceed the limits of a 16-bit integer you can do this in one word. Converting the integer to its hex equivalent in ASCII is tedious but not impossible. What I'd do is write a loop or subroutine to evaluate each 4-bit NIBL in turn and convert it to its hex ASCII representation and then concatenate (ACN) the resulting characters into the complete value.

If the values do exceed 16-bit limits there are multiple threads addressing the FLOATS to INTS conversion problem.
__________________
The difference between stupidity and genius is that genius has its limits. -- Albert Einstein
  Reply With Quote
Old July 6th, 2006, 09:39 AM   #3
TConnolly
Lifetime Supporting Member
United States

TConnolly is offline
 
TConnolly's Avatar
 
Join Date: Apr 2005
Location: Salt Lake City
Posts: 5,850
Have you checked the AB Knowledgebase?

A quick search on "hexadecimal" uncovered several technotes on converting INTs to Hex strings and sending Hex info over the com ports.

http://domino.automation.rockwell.co...4?OpenDocument

http://domino.automation.rockwell.co...1?OpenDocument

http://domino.automation.rockwell.co...5?OpenDocument

http://domino.automation.rockwell.co...2?OpenDocument

There are more as well.
  Reply With Quote
Old February 4th, 2012, 02:10 PM   #4
spaceacealpha
Member
United States

spaceacealpha is offline
 
spaceacealpha's Avatar
 
Join Date: Sep 2009
Location: Tennessee
Posts: 71
That doesn't do you any good if you don't have a tech connect paid service.
  Reply With Quote
Old February 4th, 2012, 02:23 PM   #5
Mickey
Lifetime Supporting Member
United States

Mickey is offline
 
Mickey's Avatar
 
Join Date: May 2003
Location: Palmdale,Ca
Posts: 8,387
Quote:
Originally Posted by spaceacealpha View Post
That doesn't do you any good if you don't have a tech connect paid service.

6 years ago when he posted those they were probably free.
__________________
Mickey

If you want happiness for an hour-take a nap. If you want happiness for a day-go fishing. If you want happiness for a month-getmarried. If you want happiness for a year-inherit a fortune. If you want happiness for a lifetime-help someone else.
----- Chinese Proverb
  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
where down load demo RSLogix 500 software? dyan256 LIVE PLC Questions And Answers 18 June 6th, 2013 07:24 AM
Shifting I/O Modules, Slots: RSLogix 500 Question mbd0722 LIVE PLC Questions And Answers 8 February 4th, 2012 04:56 PM
RSLogix 5000 V15 Features Samneggs LIVE PLC Questions And Answers 18 April 20th, 2006 05:45 PM
RSLogix 500 bug bit me today.... jstolaruk LIVE PLC Questions And Answers 1 February 3rd, 2006 01:08 AM
RSLogix 500 Vs. RsLogix 5 mrdmrd LIVE PLC Questions And Answers 7 February 21st, 2005 05:11 AM


All times are GMT -5. The time now is 05:08 AM.


.