paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Paparazzi-devel] Scaling factor: uint16_t into float


From: Brendan Chen
Subject: RE: [Paparazzi-devel] Scaling factor: uint16_t into float
Date: Thu, 16 Oct 2008 22:14:36 +1000

Hi Gautier,

Yea the last option is exactly what im doing. I've got the message showing on 
gnd station after adding a new tab in the messages.xml and all, but I used the 
ADC_GENERIC utility set to read the ADC (not sure if you call that cheating 
because I dont know how to set my own set of code for it to read the ADC from 
scratch).

Now my problem is that I can get the ADC data reading and its displaying a 3 
digit integer (uint16_t I presume), but now I want that to display in a 2 
decimal place floating number.

How would I scale that uint16_t raw number to the floating point number I want?


Thanks
Brendan

________________________________________
From: address@hidden address@hidden On Behalf Of Gautier Hattenberger 
address@hidden
Sent: Thursday, 16 October 2008 10:05 PM
To: address@hidden
Subject: Re: [Paparazzi-devel] Scaling factor: uint16_t into float

The ADC uses a 10 bits converter. So it gives values between 0 (0V) and
1023 (3V, unless you use adc 5 or 6 of a Tiny2.x).

For your problem, it all depends of the way you want to use these values.
- You can display them in a real time plotter with a scaling factor.
- You can use the values in the log file after your flight.
- You can write a small Ivy agent (C,Ocaml) that read the values coming
from the telemetry and do whatever you want.
- You can write a piece of airborne code that reads the adc value,
define a new message and send it to the ground.

Gautier


Brendan Chen a écrit :
> Hi all,
>
> Anyone know where and how to convert the downlinked ADC_GENERIC value into a 
> more meaningful value?
>
> I could be wrong but from what i understand, the ADC_GENERIC function returns 
> a uint16_t value... I would like to scale that down by a factor of 208.3 
> (adc_generic_val1 / 208.3) and give a return in 2 decimal float number.
>
> How and where would I do that?
>
>
> Thanks
> Brendan
>
>
> _______________________________________________
> Paparazzi-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/paparazzi-devel
>


_______________________________________________
Paparazzi-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/paparazzi-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]