formule dBm naar mW Picbasic

Ik ben een Watt meter aan het maken op basis van de ad8307.
Het elektronisch gedeelte is al klaar.
De ad8307 geeft mooi 25mV/dBm
Ik wil nu in Picbasic van dit getal een Wattage krijgen aan de hand van deze formule:
P(mW)=1mW.10(PdBm/10)
Hoe krijg ik deze formule omgezet in Picbasic?

Frederick E. Terman

Honourable Member

Wat is het probleem; kan PICBASIC geen 10-tot-de-macht? LOG10 zit er wél in.

Maar je kunt ook EXP gebruiken: P(mW) = EXP(PdBm*LN(10)/10)

waarbij je LN(10)/10 misschien ergens als een constante opslaat, of hoe dat in PICBASIC ook het gemakkelijkst gaat.

Keramisch, kalibratie, parasitair: woordenlijst.org

Misschien dat dit wel in Picbasic zit ,maar hoe noemt men 10x ?

Hensz

Golden Member

Don't Panic!
Frederick E. Terman

Honourable Member

Ik zou gokken dat EXP hoort bij LN. Vandaar mijn rekenvoorbeeld: neem je dBm-waarde, doe hem maal een constante, gebruik EXP - klaar.

Als er een gewone machtsverhef-functie in PICBASIC zit, kun je die natuurlijk gebruiken, met 10 als grondtal. ^ is het echter niet, dat is al wat anders.
Bij DCD staat iets over machtsverheffen, maar ik weet niet wat het betekent.

[Bericht gewijzigd door Frederick E. Terman op zondag 16 juli 2017 21:47:52 (10%)

Keramisch, kalibratie, parasitair: woordenlijst.org

Ik heb een rekenmachine ("bc"), die heeft "e" als functie die bij jou waarschijnlijk "EXP" heet. En "l" als functie die bij jou "LN" heet.

Ik heb als voorbeeld "30" ingevuld als het aantal dBs. Antwoord moet 1 zijn, is 0.9999...

code:

.001 * e(l(10)*30/10)
.99999999999999999997

jij krijgt dan iets als

code:

w = .001 * EXP (LN(10)*db/10)
four NANDS do make a NOR . Kijk ook eens in onze shop: http://www.bitwizard.nl/shop/
JoWi

Special Member

Op 16 juli 2017 21:39:32 schreef 19roland70:
Misschien dat dit wel in Picbasic zit ,maar hoe noemt men 10x ?

POW als ie er in zit.

Ignorance is bliss

Dit staat in de helpfile:

code:


Pow

Syntax
Assignment Variable = Pow(Variable, Pow Variable)

Overview
Computes Variable to the power of Pow Variable.

Operands
Assignment Variable can be any valid variable type.
Variable can be a constant, variable or expression.
Pow Variable can be a constant, variable or expression.

Example
Device = 18F25K22 ' Choose the device
Declare Xtal = 16 ' Choose the oscillator frequency used
Declare Hserial_Baud = 9600 ' Choose the Baud rate for HrsoutLn
Dim PowOf as Float
Dim Floatin as Float ' Holds the value to Pow with
Dim Floatout as Float ' Holds the result of the Pow
PowOf= 10
Floatin = 2 ' Load the variable
Floatout = Pow(Floatin,PowOf) ' Extract the Pow of the value
HrsoutLn Dec Floatout ' Display the result
Stop

Notes
Pow is not implemented with 12, or 14-bit core devices, however, with the extra functionality,
and more linear memory offered by the 18F devices, full 32-bit floating point power of is implemented.

Floating point trigonometry is extremely memory hungry, so do not be surprised if a large chunk
of the microcontroller’s code memory is used with a single operator. This also means that floating
point trigonometry is comparatively slow to operate.

When implementing trigonometry, or other built in, functions within an expression, always wrap
them in parenthesis, otherwise the parser may consider the extra operands as part of the trigonometry
parameter and produce an incorrect result. For example:
MyAssignment = (Pow(MyVar1, MyVar2)) + MyVar3
Frederick E. Terman

Honourable Member

Daar zul je 'm hebben. Gebruik die functie voor tien-tot-de-macht.

Keramisch, kalibratie, parasitair: woordenlijst.org

Ik was nog benieuwd of je de ADC van de Pic gebruikt of een aparte ADC toepast? Dit ivm het oplossend vermogen van een 10bit ADC (60,2dB) of een 14bit ADC of meer die 84dB of 96dB aankan...terwijl het dynamisch bereik van de AD8307 90dB is...

Re-integratiecoach uitgerangeerde en degoutante electronen

Op 19 juli 2017 23:48:20 schreef Arabel:
Ik was nog benieuwd of je de ADC van de Pic gebruikt of een aparte ADC toepast? Dit ivm het oplossend vermogen van een 10bit ADC (60,2dB) of een 14bit ADC of meer die 84dB of 96dB aankan...terwijl het dynamisch bereik van de AD8307 90dB is...

Ik gebruik hier de 10 bit adc van de 18f4550.

Arco

Special Member

Je kunt altijd nog een 18F4553 gebruiken als je wat meer (12 bits a/d) wilt, is zo te zien pin-compatible...

Arco - "Simplicity is a prerequisite for reliability" - hard-, firm-, en software ontwikkeling: www.arcovox.com