MAX1270 Questions???
fiveslo
Posts: 40
I finally got along to wiring and trying out my sample MAX1270 ADC from Maxim. Anyways as you all have probably figured, I'm having problems... Anyways, the code that I've basically copied from the StampPLC, is acting very strangely, in the sense that the output in the DEBUG window is reading weird values. I've found that the minimum voltage that can be read is somewhere around 1.6V, when it gets there the DEBUG lists a 0mV reading... and when I get to 5V, I'm getting readings around 160???? The config variable has been forced to read channel 0 in a unipolar format, yet with no acceptable results... From what I gather the datasheet for the MAX1270, the way its wired in the StampPLC, the minimum 1.6V has something to do with input to a buffer/amp??? that has this "magical" 1.6V as a input.. is this a correct assumption??? How do I get this MAX1270 to read 0-5V correctly?? Does anyone have any "sample" working code for this, please help....
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
Code is as follows, basically copied and slightly altered from StampPLC pdf....
'{$STAMP BS2p}
'{$PBASIC 2.5}
'
ClkAdc······PIN 7··········· ' A/D clock
CsAdc······ PIN 8··········· ' Chip Select for ADC
AoutAdc····PIN 9··········· ' A/D Data out
AinAdc····· PIN 10·········· ' A/D Data in
adResult··· VAR Word
mVolts····· VAR Word········ ' ADC in millivolts
Main:
DO
LOW CsAdc
SHIFTOUT AoutAdc, ClkAdc, MSBFIRST, [noparse][[/noparse]%11100000] 'Ch2 0-5 VDC
HIGH CsAdc
LOW CsAdc
SHIFTIN AinAdc, ClkAdc, MSBPRE, [noparse][[/noparse]adResult\12]
HIGH CsAdc
adResult = adResult + (adResult ** $D6C) MAX 4095 ' x ~1.05243
' millivolts conversion
' -- returns signed value in bipolar modes
' -- uses raw (12-bit) value
'
'mVolts = adResult + (adResult ** $3880) ' x 1.2207
DEBUG " ADC2:", SDEC adResult, CR
PAUSE 500
LOOP
I commented out the mVolts, since the accuracy was nowhere near the input voltage of Channel 2...
From what I've experimented with, I just cannot seem to get the StampPLC program to display the correct voltage. It will give a 4096 or max output when I give it a around +5V input, however then as I turn the pot, to lower the voltage, I get a 0 when I get to around 1.3-1.4 V in... I 've tried different channels, and the same happens.· What am I doing wrong??????