Ammeter with Maxim 4172

Roseandthistle

New Member
Hi all.
I'm working on an ammeter using Maxim's High side current monitor.
It seems to be a really slick chip. I've managed to calibrate the output with reference to a quaility ammeter.The readings I get are: 1.804vdc out with respect to .1804 Amps. The chip's power comes from the same power as the picaxe 28x2. 5vdc.
Now the issue:
I want to read the max4172 out to ADC0. and have the picaxe calculate and display the number on a serial lcd. Everything works, except I get a single digit i.e. (.2) on the lcd. I would like 4 digits i.e. (.1804).
This can't be that difficult. I've set the adcsetup 0, readadc10, word variable, 1023 bit, ect.
Any help is appreciated.
Thanks
 

Attachments

eclectic

Moderator
Just a thought.

If you post your program as a .bas file

1. It must be downloaded.
2. Then it must be saved.
3. Then the Programming Editor must be opened.
4. Then the file must be opened
5. Then the program can be viewed.

or
Code:
; 
#PICAXE 28X2
'#COM 4
#SLOT NUMBER 0
#FREQ M4



let adcsetup = 0


'SET CONSTANTS/VARIABLES

SYMBOL BR = T9600
SYMBOL SENSADC = W0
SYMBOL REFADC = 1023
pause 1000


Do
 	READADC10 0,SensADC
 	b15 = 0
      W1 = W0 * REFADC / 1023
      W2 = W1 //1000
 	serout A.1,BR,(254,151,".",#W2)
 	pause 1000
LOOP
I've just done it.

But, ...........
others may not.
e
 

eclectic

Moderator
This might help

Code:
w0 = 1804

w1 = w0 /1000

w2 = w0 // 1000

sertxd (#w0," ", #w1, " ",#w2,cr,lf)
It does not simulate correctly,
but
it works on a real chip. :)

e
 

westaust55

Moderator
Just a thought.

If you post your program as a .bas file

1. It must be downloaded.
2. Then it must be saved.
3. Then the Programming Editor must be opened.
4. Then the file must be opened
5. Then the program can be viewed.
e
@eclcetic,

it is possible to open a .bas file directly into notpad (or other text handler). I do it regularly - might be a case of what program defaults are set
 
Top