Hi Guru's,
I have researched pretty hard trying to find the clever answer to my current query. I have semi found the answer, but can't find how I can implement my values.
The resolve appears to be cleverly written by the proven master of math around these parts, AllyCat (Alan) and can be viewed in the code of post #1 here in this thread. I altered the values denoted by Symbol NUMERATOR and Symbol DIVISOR and Alan's code did return the value I had hoped.
What I can't figure out is how to effectively get my values into a SYMBOL/S on the fly (if this is even possible) in order to process my required calculations a number of times.
With the best possible accuracy using PICAXE 10bit ADC, a 5.000 VDC reference, a 0.1% 510R ohm resistor for R2 and scaling up and down where necessary, I basically want to determine the unknown value of R1 in the attached circuit being any value between 0-310 ohms. Beyond 310 ohms will be deemed a fail.
*****************************************
eg.
RawADC = 1022
Vin = 5
R2 = 510
Vout = RawADC*Vin/1023
= 1022*5/1023
= 4.99511241 VDC
R1 = (R2*Vin) / Vout - R2
= (510*5) / 4.99511241 - 510
= 0.49902198 OHMS
*****************************************
Or is there a better/simpler/smarter way?
Thanks in advance Guru's.
Regards,
Mort.
I have researched pretty hard trying to find the clever answer to my current query. I have semi found the answer, but can't find how I can implement my values.
The resolve appears to be cleverly written by the proven master of math around these parts, AllyCat (Alan) and can be viewed in the code of post #1 here in this thread. I altered the values denoted by Symbol NUMERATOR and Symbol DIVISOR and Alan's code did return the value I had hoped.
What I can't figure out is how to effectively get my values into a SYMBOL/S on the fly (if this is even possible) in order to process my required calculations a number of times.
With the best possible accuracy using PICAXE 10bit ADC, a 5.000 VDC reference, a 0.1% 510R ohm resistor for R2 and scaling up and down where necessary, I basically want to determine the unknown value of R1 in the attached circuit being any value between 0-310 ohms. Beyond 310 ohms will be deemed a fail.
*****************************************
eg.
RawADC = 1022
Vin = 5
R2 = 510
Vout = RawADC*Vin/1023
= 1022*5/1023
= 4.99511241 VDC
R1 = (R2*Vin) / Vout - R2
= (510*5) / 4.99511241 - 510
= 0.49902198 OHMS
*****************************************
Code:
'08M2 PICAXE
Symbol RawADC = w0
Symbol Vin = w1
Symbol Vout = w2
Symbol R1 = w3
Symbol R2 = w4
Vin = 5
R2 = 510
readadc10 c.4, RawADC
Vout=RawADC*Vin/1023
R1=R2*Vin/Vout - R2
sertxd(#R1,cr,lf)
end
Or is there a better/simpler/smarter way?
Thanks in advance Guru's.
Regards,
Mort.