Resource icon

Scaling numbers or how avoid floating point. 2013-01-19

Status
Not open for further replies.

3v0

Coop Build Coordinator
Forum Supporter
3v0 submitted a new article:

Scaling Numbers or how avoid floating point. - Part I: The voltage divider.

Because eight bit mircocontrollers lack floating point instruction


Read more about this article...
 
Excellent article. This is especially useful to ASM programmers, as it's the only real way to do things.
 
Nice article 3V0 , only thing I would like to comment on is the possible inclusion of two diodes to clamp the voltage as seen at the ADC pin.

@Sceadwian: It sure is, if portability and your time are not of concern. Plus for hobbyists who cares what language is used if the job gets done?
 

PIC's already have internal clamping diodes to 0V and Vsup.
 
wouldn't the vpc = 100v/1023, since the max count is 1023 at 100v? Which would be .0975 vs .0976, not a big deal at this range, but might be if you were scaling a 12v input and needed more precesion. I just did a voltmeter project where my reference was 1.024V and I needed to read precesion millivolt readings. the max input of which was 1.010V, and the extra count would have made a big difference.
 
PIC's already have internal clamping diodes to 0V and Vsup. .

but why risk blowing up your PIC chip on a voltage surge. External clamping really is needed here, especially if you are interfacing your controller pin to the outside world. The internal clamps are puny and if the energy of the surge is too great, you also risk blowing up anything else connected to the 5V pic supply.

Also, your 1k/19k divider is pretty much the max impedance your ADC wants to see on the input. Most ADCs call for an impedance of 1K or less. Your divider yields an impedance of 952Ω.
 
Please note Mark Odom's comment on the max impedance.

The picture of the voltage divider was lost in the disk crash. I have it in my computer but can not find a way to add it here.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…