Well thanks a lot for the suggestion. It is amazing how much you can
simplify processes with matching or suitable numbers.
threeneurons schrieb:
- Just to save a bit of time on all those floating point
calculations...
Why fart with all this floating point calculating stuff. That's just a
lot of extra code libraries, and way more execution time. I know, in
this particular app, it really doesn't matter, but in the old days, we
did it differently.
It is always good to know the old ways. When there are new technical
innovations, people tend to get light-headed and often waste resources.
[...]
Here's a table of some values:
Input. ./128 ...N.. .20xN ../64
==== ==== ==== ==== ====
320V 2.50V 1024 20480 320
300V 2.24V 960 19200 300
180V 1.41V 576 11520 180
100V 0.78V 320 6400... 100
Magic, how that works out !
Yep, it is quite nice. But I think there is one problem, see, in case
2.5V are on the ADC pin this would not generate a 1024 but a 1023,
resulting in 20 * 1023 / 64 = 219.7V, but with an integer that becomes 219V.
Note: all the values are less than 32767, so you don't need to worry
about all that signed/unsigned crap.
If you don't want to go out and buy those two resistors, you can get
the same ratio using a fixed resistor and a trim pot. Multi-turn
preferred. I bet you have something that will make that 128:1 ratio in
your junk box.
Hmm I will check it on the weekend, but I seriously need to re-stock on
some resistors :-)
Sadly my electronics store (www.reichelt.de) does not stock 10M
resistors at .1%, only 1%, as do all other suppliers I checked. So I
should probably go for a 10M 1% and adjust the lower part with some 95K
and a 10K multi turn pot, right?
Thanks again,
Jens
Many thanks again,
Jens
--
You received this message because you are subscribed to the Google Groups
"neonixie-l" group.
To post to this group, send an email to neonixi...@googlegroups.com.
To unsubscribe from this group, send email to
neonixie-l+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/neonixie-l?hl=en-GB.