Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
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

Part I: The voltage divider.

Because eight bit mircocontrollers lack floating point instructions using floating point can consume a lot of processor cycles.

In this article I will illustrate how to measure up to 100VDC with an analog to digital converter, ADC, with a positive voltage reference of 5V, +Vref, and a negative voltage reference at gnd -Vref.

The input to the the ADC must never exceed the 5V value of +Vref. We can use a simple voltage divider to accomplish this. To...

Read more about this article...
 
Excellent article. This is especially useful to ASM programmers, as it's the only real way to do things.
 
Thanks for the link 3v0. That'll help a lot!
 
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?
 
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Ω.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top