Shop OBEX P1 Docs P2 Docs Learn Events
ADC 0832 - dificulties with single ended chanel — Parallax Forums

ADC 0832 - dificulties with single ended chanel

AmaralAmaral Posts: 176
edited 2008-06-27 01:09 in BASIC Stamp
Hello all

I'm trying to read both channels of an ADC0832 but since this has a MUX for selecting the channels I'm having serious problems on configuring this.
I think the problem starts when it needs an start bit to begin reading the channel selector and the polarity!

the sequence should set ch0 to + single ended ... but it doesn't

LOW CS
· SHIFTOUT DI,CLK,0,[noparse][[/noparse]%10]
· SHIFTIN DDO,CLK,0,[noparse][[/noparse]val]
·HIGH CS

It seems to be always connected to ch1· I'm not finding the reason.

Any help will be gratly apprecited

Amaral

Comments

  • AmaralAmaral Posts: 176
    edited 2008-06-26 22:07
    I'll bring the topic up again !

    Does anyone worked with ADC0832 or up , and monitored two channels ?


    Thanks for the attention!
  • MSDTechMSDTech Posts: 342
    edited 2008-06-26 22:16
    I haven't used the ADC0832, but the following snippet is from a larger program that reads the 4 channels of an ADC0834.

    RS_Voltage VAR Word
    Instrument Var Byte
    VoltSelect VAR Nib

    PM_BT_CS··· PIN··· 2
    PM_V_CS···· PIN··· 3
    PM_Din····· PIN··· 4
    PM_Dout···· PIN··· 5
    PM_Clk····· PIN··· 6


    SolarV1·· CON %1100 ' A/D MUX IDs for Ch 0..3
    SolarV2·· CON %1110 ' Bit 3 = 1, start bit
    SolarV3·· CON %1101 ' Bit 2 = 1, single (1)/diff (0)
    BattBus·· CON %1111 ' Bit 1 odd / sign, Bit 0 select

    Select Instrument
    · CASE "S"
    ··· VoltSelect = SolarV1
    ··· GOSUB ReadVoltages
    · CASE "U"
    ··· VoltSelect = SolarV2
    ··· GOSUB ReadVoltages
    · CASE "N"
    ··· VoltSelect = SolarV3
    ··· GOSUB ReadVoltages
    · CASE "B"
    ··· VoltSelect = BattBus
    ··· GOSUB ReadVoltages
    EndSelect

    ReadVoltages:
    · HIGH PM_V_CS· 'Deactivate the ADC0834 Voltage Monitor
    · LOW PM_Clk
    · LOW PM_Din
    · DataValue = 0
    · 'A2D_Start_Conversion
    · LOW PM_V_CS
    · SHIFTOUT PM_Din,PM_Clk,MSBFIRST,[noparse][[/noparse]VoltSelect\4]
    · PULSOUT PM_Clk,10·· '20 uSec for data conversion
    · SHIFTIN PM_Dout,PM_Clk,MSBPRE,[noparse][[/noparse]DataValue.LOWBYTE]
    · HIGH PM_V_CS
    RETURN


    Post Edited (MSDTech) : 6/26/2008 10:25:00 PM GMT
  • AmaralAmaral Posts: 176
    edited 2008-06-27 01:09
    Thanks MSD Tech

    But I figured it out in the hard way !
    now it's working , the whole problem is that the MUX add ignores leading zeros and the setting is not that simple .. but its working perfectly now

    Thanks you all for the attention on reading this

    Amaral
Sign In or Register to comment.