Shop OBEX P1 Docs P2 Docs Learn Events
Pin11 issue with MCP3208 — Parallax Forums

Pin11 issue with MCP3208

MD2010MD2010 Posts: 11
edited 2011-07-26 13:46 in Propeller 1
I am working with the MCP3208 A/D. I designed my own board placing two 3208 on it. One is working fine and the other one is not. I assembled two boards and I noticed the same problem on both boards. There is no short on the board. I was able to duplicate this issue with the Proto board as well. For some strange reason I can’t communicate with the 3208 if I use pin11. I am able to control pin11 using the Blink program so there is nothing wrong with that pin. Is there any limitation using pin11? Communication with the 3208 is fine using other pins.

Comments

  • JonnyMacJonnyMac Posts: 9,208
    edited 2011-07-25 10:20
    It's hard to evaluate a problem that you can't "see." If you post your code I'm sure somebody will come up with a solution; the MCP3208 is a crowd favorite (I use it all the time) and most of us have never had pin issues.
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2011-07-25 15:22
    MD2010 wrote: »
    I am working with the MCP3208 A/D. I designed my own board placing two 3208 on it. One is working fine and the other one is not. I assembled two boards and I noticed the same problem on both boards. There is no short on the board. I was able to duplicate this issue with the Proto board as well. For some strange reason I can’t communicate with the 3208 if I use pin11. I am able to control pin11 using the Blink program so there is nothing wrong with that pin. Is there any limitation using pin11? Communication with the 3208 is fine using other pins.
    Let us see your code.
    What driver are you using?
  • MD2010MD2010 Posts: 11
    edited 2011-07-25 17:32
    Here you go.

    VAR

    byte menu
    long stack[60]
    long Vo, T1, T2

    OBJ

    Debug : "FullDuplexSerialPlus"

    delay : "timing1722"
    DAC : "MCP3208_fast"
    DAC1 : "MCP3208_fast"
    Num : "Numbers"
    SN : "Simple_Numbers"
    FS : "FloatString"
    FM : "FloatMath"
    LCD : "LCD_16x2_4Bit_3208"

    PUB LedOn | tch, tcl, V1,Vcal, Vout ' Method declaration
    Debug.Start(31, 30, 1, 115200)
    LCD.START
    LCD.MOVE(1,1)

    delay.pause1ms(100)
    DAC.start(25,24,26,0) 'in/out, CLK, CS, mode
    DAC1.start(12,13,11,0) 'in/out, CLK, CS, mode
    delay.pause1ms(100)
    LCD.CLEAR
    Debug.tx(CLS)


    Debug.tx(CR)
    repeat

    delay.pause1ms(1000)
    Debug.str(String("Start"))
    delay.pause1ms(10)
    Debug.tx(CR)
    Vo := DAC.in(1)
    Vo := FM.FMul(Vo, 23.00)
    Vcal := FM.FMul(Vo, 4.096)
    Vout := FM.FDiv(Vcal, 4096)
    Debug.str(String("Dac0 ch CH0:"))
    debug.str(FS.FloatToString(Vout))
    Debug.tx(CR)
    delay.pause1ms(10)
    Debug.tx(CR)
    Vo := DAC1.in(0)
    Vo := FM.FMul(Vo, 20.85)
    Vcal := FM.FMul(Vo, 4.096)
    Vout := FM.FDiv(Vcal, 4096)
    Debug.str(String("Dac1 ch CH0:"))
    debug.str(FS.FloatToString(Vout))
    Debug.tx(CR)
  • CumQuaTCumQuaT Posts: 156
    edited 2011-07-25 18:00
    I may be wrong, but it looks like you haven't enabled enough pins on your DACs... Try to use something like:

    ADC.start(25, 24, 26, %0000_0000_1111_1111)

    to enable all the pins (though you should only enable the ones you need)

    Though of course I've done it long-hand here, you should probably use positional notation.
  • JonnyMacJonnyMac Posts: 9,208
    edited 2011-07-25 18:41
    As CumQuaT suggests, your problem could be in how you're using an object method. Why not hit the fast forward button and post your project archive? Most of us would be willing to drop in onto our local machines to give it a look. Scanning an unformatted code listing doesn't help.

    A flag for me is an object called LCD_16x2_4Bit_3208. I've written a ton of LCD code, and used the MCP3208 in products that are for sale -- why you're LCD seems tied to the 3208 is a mystery and could explain funny pin interactions. That's speculation, though, because you didn't post the whole project for inspection.
  • jeff-ojeff-o Posts: 181
    edited 2011-07-26 04:56
    Dunno if it helps, but did you know that you can share Data I/O and clock pins between the ADCs? The only thing that needs to be unique is the CS pin. Of course, you need to make sure that only the ADC you want is enabled when trying to read from it. Perhaps this way, with a bit of code tweaking, you'd only have to run one ADC object on one cog.
  • MD2010MD2010 Posts: 11
    edited 2011-07-26 09:15
    Thanks for responding. Please ignore LCD : "LCD_16x2_4Bit_3208".
    I don’t have any issue with DAC.start(25,24,26,0). It is working fine. I can’t get DAC1.start(12,13,11,0) to work. As I mentioned before, if I change Pin11 to pin10 or any other pin, DAC1.start(12,13,10,0) works fine. Jeff-o, to get my project running I’m sharing pin26. Now I have DAC.start(25,24,26,0) and DAC1.start(12,13,26,0) . This solution seems to work, but it doesn’t explain why DAC1.start(12,13,11,0) doesn’t work with pin11.
  • jeff-ojeff-o Posts: 181
    edited 2011-07-26 12:11
    I'd look at the hardware, but you said it's the same on three different boards. Very odd indeed. Does DAC.start work with pin 11, by any chance? Does anything work with pin 11 (can you blink an LED, for example?)
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2011-07-26 13:46
    jeff-o wrote: »
    I'd look at the hardware...
    Maybe we need to see some schematics.
Sign In or Register to comment.