PDA

View Full Version : Current Measurement



mcbeasleyjr
- 24th May 2009, 16:31
I am using the PIC16F877A to measure current flowing through a shunt. The way that it works is basically this: with every 10mA increase in current, the adc should increase by 1. I need help with a program to output this current on an lcd. What I'm doing right now is using a bunch of if statements but as you can imagine this eats up alot of code space as well as time... any help would be greatly appreciated. Thank you all in advance.

Note: I'm using microcode studio plus with the pbp language. Not too fluent in assembly.

ScaleRobotics
- 24th May 2009, 17:46
The way that it works is basically this: with every 10mA increase in current, the adc should increase by 1.

Hello mcbeasleyjr,

I think you might need to give us more information. Otherwise, you may just get answers like this:



adc_result = adc_result * 10 '10mA per value of adc_result
lcdout $FE,1,#adc_result," mA"

mcbeasleyjr
- 24th May 2009, 17:49
you know... looking at that, i always try to make things complicated... lol. from what you've posted here i realize that whatever the value of the adc is it will multiply it by the 10mA and give me the answer i need. i thank you for that. eliminates all those annoying if statements.