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 CCS Technical Support

Binary to float or some thing?

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



Joined: 08 Sep 2003
Posts: 105
Location: New Castle, DE

View user's profile Send private message

Binary to float or some thing?
PostPosted: Wed Feb 28, 2007 7:11 am     Reply with quote

I'm not the sharpest tool in the shed when it comes to math but I'm not that a total idiot either.
I'm working with the Cirrus Logic CS5463 Power IC and a PIC18F4550.
Ok the issues is the data coming back from the CS5463 I don’t understand how to convert it to some thing useable like a float or an int32.
All ADC that I have worked with have a bit weight so the returned value is multiplied by this bit weight and you have your number.
I don’t understand the data sheet explanation of the returned data from this CS5463.
The full data sheet is located at this link.
http://www.cirrus.com/en/pubs/proDatasheet/CS5463_F1.pdf

The page and items that I'm look for help on are on page 28, RMS current & voltage register.

[img]http://pg.photos.yahoo.com/ph/troncam/detail?.dir=fea6re2&.dnm=5bb8re2.jpg&.src=ph[/img]

(Sorry i can not make the img thing work. how do you get and img in a post?)

I don’t understand the Epsilon register at all is this a float? It looks kind like a float format but I don’t think that I see the whole picture.
Also the voltage and current RMS confuse me also.
Any help that any one can give would be extremely appreciated.
Thanks all
Tom
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Wed Feb 28, 2007 9:48 am     Reply with quote

The RMS V and I register is simply read - no scaling. The number is built as follows:

The MSB is defined as 2^-1, or one half (1/2). The next bit (going right) is 2^-2, or one quarter (1/4). The next one represesents 1/8, 1/16, 1/32, etc until the LSB, which is 2^-24 = 59.6 x 10^-9. The data sheet also states that this register can have values ranging from 0 to <1.

So if the RMS I was 0, this register would be all 0's. If it was 0.5A, the register would contain 0x80 00 00. If it was 0.375A, it would contain 0x60 00 00 (= 1/4 plus 1/8). And so on and so on and so on. If all bits were set, 0xFF FF FF, the measured current/voltage would be 0.999999999A.

The easiest way to deal with these values in a PIC would be to store them as unsigned int32's. Then scale as appropriate by noting that 0x01 00 00 00 = 1 amp/volt.

The epsilon register is similar, but it can range from -1 to < 1. The MSB in this register is the sign bit - if it's a 1, then the number is negative. I don't get why this register can hold negative numbers when the datasheet states that "negative values have no significance." Question

Hope this helps.
Tom-H-PIC



Joined: 08 Sep 2003
Posts: 105
Location: New Castle, DE

View user's profile Send private message

Thanks newguy
PostPosted: Wed Feb 28, 2007 11:59 am     Reply with quote

Thank you for the help.
Yes the Espilon register statement threw me for a loop also.
I don't have any idea why it is that way or the total understanding of that statement.
And again thanks for taking the time to look at it.
Tom
Sarada



Joined: 02 Jun 2008
Posts: 2

View user's profile Send private message

binary to float or something
PostPosted: Mon Jun 02, 2008 4:51 am     Reply with quote

Dear Sir I am using CS5463 with PIC 18f4550 i am able to get 3 bytes of data the MSB is -(2^0) then 2^-1 --------to 2^-23 please help me on Conversion and how to get current and voltage readings in Decimal format eg.230V and 5A . awaiting for you reply.
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