![]() |
||
|
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
| ||
New Here? Please read this important info!!!
|
|
#1 |
|
Member
![]() Join Date: Jul 2006
Location: Murfreesboro
Posts: 2
|
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 |
|
|
|
#2 |
|
Member
|
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 bitterness of poor quality remains long after the sweetness of low price is forgotten” – Benjamin Franklin |
|
|
|
#3 |
|
Lifetime Supporting Member
|
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. |
|
|
|
#4 |
|
Member
|
That doesn't do you any good if you don't have a tech connect paid service.
|
|
|
|
#5 | |
|
Lifetime Supporting Member
|
Quote:
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 |
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Topics
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shifting I/O Modules, Slots: RSLogix 500 Question | mbd0722 | LIVE PLC Questions And Answers | 8 | February 4th, 2012 04:56 PM |
| where down load demo RSLogix 500 software? | dyan256 | LIVE PLC Questions And Answers | 16 | December 9th, 2011 07:34 AM |
| 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 |