Announcement

Collapse
No announcement yet.

I2C Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I2C Help

    I am trying to reuse some I2C code that I wrote for a Picasso-based uLCD-43 and apply it to my new uLCD-70 (Diablo based)

    The uLCD-43 had the SDA and SCL pins connected directly to the SDA and SCL pins of my DAC. I saw another forum post asking about external pullups. I have not connected any external pull up resistors to this design, so if the Picasso did not require them and the Diablo does require them, maybe that is my problem. (at any rate I will continue asking my question) I have noticed that the Picasso processor datasheet says nothing about wiring up I2C but the Diablo processor datasheet has a diagram showing what looks like 4.7Kohm pull up resistors? I pasted it below.





    Here is my code:
    #platform "uLCD-70DT"

    #inherit "4DGL_16bitColours.fnc"

    var open;
    var start;
    var writeaddr;
    var ackstatus;


    func main()

    gfx_ScreenMode(LANDSCAPE) ; // change manually if orientation change

    //print("Hello World") ; // replace with your code

    txt_MoveCursor(0,0);
    putstr("open?");
    txt_MoveCursor(1,0);
    putstr("start:");
    txt_MoveCursor(2,0);
    putstr("waddr:");
    txt_MoveCursor(3,0);
    putstr("ackst:");



    repeat

    write2DAC(1023);
    pause(5000);
    write2DAC(511);
    pause(5000);
    write2DAC(0);
    pause(5000);

    forever

    endfunc

    func write2DAC(var data)

    //YOU CAN IGNORE THIS BIT TWIDDLING
    var upFour;
    upFour := 0b0000001111000000 & data;
    var firstFour;
    firstFour:= upFour >> 6;
    var lowSix;
    lowSix := 0b0000111111 & data;
    var lastSix;
    lastSix := lowSix

  • #2


    On Picaso because the pins are 'I2C dedicated' the resistors are installed on the board.

    On Diablo, because you need to 'define' the I2C pins, you also need to add the (normally 4k7ohm)resistors to those pins.
    Mark

    Comment


    • #3


      Thanks for the quick response, Mark.

      I will grab some 4.7Kohm resistors and see if this solves my problem.

      Should the Vcc be 3.3V? And if so, should I grab it off the 3.3V pin (pin 22 on the header)

      Thanks

      Comment


      • #4


        I'd reckon you should be able to take 3v3 off the header no probs
        Mark

        Comment

        Working...
        X