Setting up Port b for I2C on 18f2550


Closed Thread
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Sep 2007
    Posts
    26

    Default Setting up Port b for I2C on 18f2550

    Hi all,

    I am learning how to use a datasheet but it is hard going! I have just learnt ADCON1=15 switches all the A/D conversion off and makes all pins digital. Great. I understand controlling port direction with TRIS register and how to disable A/D. Very useful in the Pic world as I now understand it!

    What I want to know is when I use the PICs designated pins for SDA and SCL do I need to disable the hardware feature of I2C because as I understand it I2C comms is handled in software in PBP.

    I read in the datasheet that SDA pin can affect the baud rate generator on reset. I have a problem with garbage coming out of TX pin when I ICSP my chip since I have hooked up SDA/SCL to EEPROM. Then HSEROUT behaves erratically for the first couple of uses. Very unpredictable. Do I need to set anything in SSPEN? Would it be better to use different pins if I2C is handled in software?

    So in summary, I have made the pins digital with ADCON1=15. I have TRISB=%0000001 as I believe SCL is an output but what do I set SDA to as it is bi-directional? Is there anything else I need to do?

    I must go to bed, this is too exciting and it's 3.30AM!!

    Thanks

    Rich

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Using I2CREAD/I2CWRITE allow you to use whatever I/O you want to. If you plan to use the internal MSSP module, none of the native PBP statement will help.

    If you can, post your code here. Maybe you just need to disable the on-board MSSP.

    As long as you don't need the MSSP speed, I2CREAD/I2CWRITE work just fine.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. PICKit2 - warning about configuration words
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 4th August 2009, 14:01
  2. Problem setting ICD comipiler to LPT port
    By freddayz in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th February 2008, 09:59
  3. TRIS E setting for 18F2550
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd May 2007, 07:47
  4. Problem with A port on 18F2550
    By NL2TTL in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 9th May 2007, 22:59
  5. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts