|
-
Dec 30th, 2004, 01:12 PM
#1
Thread Starter
New Member
Real numbers via rs-232
I am communicating with a PLC using Modbus. The PLC is outputing its data to me in as a 4 byte real number. To view the data I am converting it to hex and displaying the hex on my screen but I cannot figure out how to grab the 4 bytes from the middle of my string and convert them to a single real number.
Any suggestions would be appreciated.
Thanks
Jerry
-
Jan 2nd, 2005, 01:43 AM
#2
Re: Real numbers via rs-232
is it a 4-digit number, or a 4-byte LONG number?
-
Jan 10th, 2005, 07:19 AM
#3
Thread Starter
New Member
Re: Real numbers via rs-232
I was told it is a 4 byte real number. When I view it as ASCII it does not make any real sense as to how to convert it. The PLC stores the data in BCD as well and I have taken that data to compare it to the real number value and cannot see how they relate. Unfortunately the BCD location will change so I cannot use that for my program.
Wish I had more information to give you, but that is all I have.
Thanks
-
Jan 12th, 2005, 03:56 AM
#4
Hyperactive Member
Re: Real numbers via rs-232
 Originally Posted by tipper
I was told it is a 4 byte real number. When I view it as ASCII it does not make any real sense as to how to convert it. The PLC stores the data in BCD as well and I have taken that data to compare it to the real number value and cannot see how they relate. Unfortunately the BCD location will change so I cannot use that for my program.
Wish I had more information to give you, but that is all I have.
Thanks
http://www.ray.masmcode.com/tutorial/fpuchap2.htm#real4
Education is an admirable thing, but it is well to remember from time to time that nothing that is worth knowing can be taught. - Oscar Wilde
-
Jan 12th, 2005, 12:04 PM
#5
Thread Starter
New Member
Re: Real numbers via rs-232
Thanks,
I read throught the article and now I understand what I am getting. It also gives me an idea of what I have to do to either convert it manually, or revise the way I am bringing in the data to hopefully get VB to do it for me.
Jerry
-
Jan 16th, 2005, 12:51 AM
#6
Re: Real numbers via rs-232
i find it hard to believe that it is giving you a floating point number. Convert it to binary and post it here. We'll look at it for you.
-
Jan 16th, 2005, 03:00 PM
#7
Hyperactive Member
Re: Real numbers via rs-232
 Originally Posted by tipper
Thanks,
I read throught the article and now I understand what I am getting. It also gives me an idea of what I have to do to either convert it manually, or revise the way I am bringing in the data to hopefully get VB to do it for me.
Jerry
If I'm not mistaken a 4 byte real is a visual basic single.
Education is an admirable thing, but it is well to remember from time to time that nothing that is worth knowing can be taught. - Oscar Wilde
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|