Searching \ for '[OT] Data types, floating notation' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/mems.htm?key=data
Search entire site for: 'Data types, floating notation'.

Exact match. Not showing close matches.
PICList Thread
'[OT] Data types, floating notation'
1999\10\01@043357 by Quentin

flavicon
face
Well not really OT as I am going to use it in a PIC.

I've know all the years the different data types (integers) but had an
abrupt awakening yesterday that I don't know how it is represented in
byte form.
Anybody know where I can get more info?
Can anybody please tell me what -999 will be in 4 byte floating notation
(show me the 4 bytes), and how to calculate it?
This is for serial communications, my PIC must recognize the -999 as the
start of the packet.

Thanks
Quentin

1999\10\01@101359 by Barry King

flavicon
face
> Can anybody please tell me what -999 will be in 4 byte floating notation
> (show me the 4 bytes), and how to calculate it?
That depends.  There are many floating-point number formats.  But
the most common is the IEEE 754 standard.  It is a 32-bit format.

Here's what the Hi-Tech compiler (with thanks to Clyde!) puts in for
a constant -999 as a double at address 0x20:

07F3  3000    main  movlw  0x0
07F4  1283          bcf    0x3,0x5
07F5  1303          bcf    0x3,0x6
07F6  00A0          movwf  0x20
07F7  30C0          movlw  0xC0
07F8  00A1          movwf  0x21
07F9  3079          movlw  0x79
07FA  00A2          movwf  0x22
07FB  30C4          movlw  0xC4
07FC  00A3          movwf  0x23

so that's  00  C0  79  C4

> This is for serial communications, my PIC must recognize the -999 as the
> start of the packet.
Are you really talking to a system that dumps binary format floating
point numbers on the serial port?

What about the rest of the data?  Coding a floating point conversion
is not trivial.

I recommend using a existing implementation.  A good C compiler
(as above) will have the floating point routines built in.

------------
Barry King, KA1NLH
Engineering Manager
NRG Systems "Measuring the Wind's Energy"
Hinesburg, Vermont, USA
http://www.nrgsystems.com

1999\10\01@115035 by Quentin

flavicon
face
Barry King wrote:

> so that's  00  C0  79  C4
>
That's correct, it's what I get when I monitor the port.

> > This is for serial communications, my PIC must recognize the -999 as the
> > start of the packet.
> Are you really talking to a system that dumps binary format floating
> point numbers on the serial port?
>
You sound like you were shocked :). Yes.
> What about the rest of the data?  Coding a floating point conversion
> is not trivial.
>
After the start, there comes another 8-12 numbers in 4 byte floating and
a checksum.

> I recommend using a existing implementation.  A good C compiler
> (as above) will have the floating point routines built in.
>
Problem is, I work in assembler. Anybody got routines for that?

Thanks
Quentin

1999\10\01@120118 by Quentin

flavicon
face
Quentin wrote:
>

> Problem is, I work in assembler. Anybody got routines for that?
>
Cancel that. Reading AN575 now.

Quentin

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...