I'm at a loss, and I think I need some edumacation on pbp's math system.
I'm trying to do a simple ADC voltage reading. The voltage source is a ~8 volt battery, so I made a voltage divider. With my meter I read 4.1 after the divider (which is the input to the PIC.)
Here is my code (the important parts):
My results are:Code:Quanta con 1274 ADCIN 0, ADval ' Read A/D on RA0 ADval = (ADval*10) */ Quanta ADval1 = ADval * 2 SEROUT2 PORTB.1,Baud,[dec ADval dig 4,".",dec4 ADval," Vdc",$0D,$0A] SEROUT2 PORTB.1,Baud,[dec ADval1 dig 4,".",dec4 ADval1," Vdc ADVal1",$0D,$0A]
Obviously I'm doing something right as I'm getting my 4.1 volt measurement. My problem is trying to multiply it by 2 (as you can see...)Code:4.1056 Vdc 1.6576 Vdc ADVal1
I also tried ADval1=ADval + ADval and ADval=ADval << 2, both resulting in wierd numbers.
I suppose I'm just not getting the whole floating point thing with pbp. Can someone enlighten me?
Thanks,
Jeff




Bookmarks