CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How to map floating point values over MODBUS

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
SSURESHREDDY



Joined: 10 Aug 2013
Posts: 13
Location: bangalore

View user's profile Send private message

How to map floating point values over MODBUS
PostPosted: Wed Nov 26, 2014 12:47 am     Reply with quote

Hi all,
We are designing a controller to measure voltage and current. We have floating point values like 50.4 volts and 150.2 Amps. These are to be presented on MODBUS. I like to know which is the best method, function code to do this. Some of you have must have had some experience on handling this kind of values. Can someone help us on this? I am using PIC16F1938 and C compiler v4.114

suresh
Ttelmah



Joined: 11 Mar 2010
Posts: 19346

View user's profile Send private message

PostPosted: Wed Nov 26, 2014 1:36 am     Reply with quote

Honestly, best, send them as integer.
504 tenths of a volt.
1502 tenths of an amp.
Use tenths, hundredths, or thousandths according to what the system is actually capable of measuring.

Smaller, and faster than fiddling with FP. Avoids problems of different 'types' in the systems at each end. Accurately limits the transmitted resolution, to what the system is capable of producing, etc. etc.. It is the commonest approach in all forms of industrial bus. It also makes debugging easier, since you can add a simple MODBUS analyser, and directly 'read' the values as human sensible figures.

Currently have a system returning direct probe readings in uV, converted value, in tenth PPM, temperature in degrees, flow rate in 1/10th l/min etc..
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group