I2C over parallel port communication

This is a discussion on I2C over parallel port communication within the C Programming forums, part of the General Programming Boards category; I need to read and write to an I2C bus which is connected through an adaptor to the parallel port ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Location
    DE
    Posts
    4

    I2C over parallel port communication

    I need to read and write to an I2C bus which is connected through an adaptor to the parallel port of a computer. The I2C bus can run at 400kHz frequency.

    I saw that in Linux there is an i2c-parport adaptor already implemented but I have problems using it.

    Can anyone tell me what steps should I follow to use this available adaptor or to implement my own?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So, write to 0x378 with bit 0 and bit 1 as clock and data. Use a short timer to get 400KHz timing for the clock and the data.

    What else do you need to know?

    I have done a I2C communicator many years ago in a 80186 microcontroller.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Location
    DE
    Posts
    4
    Thanks for the reply!

    If I understand you correctly, I should write 0s and 1s on the SDA and SCL pins of the parallel port. But how do I assure synchronization to respect timing conditions?

    Do you have happen to have some source code ?

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    No, the code I _HAD_ was written in 16-bit x86 assembler anyways, so not much use.

    What problem with timing are you trying to solve? As long as you make sure the clock and data (SCL and SDA) changes in synch with each other, there should be no problem.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Mar 2009
    Location
    DE
    Posts
    4
    That was exactly my question: how to make sure that SCL and SDA changes in sync?
    I am using Ubuntu Linux...

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by bogdan View Post
    That was exactly my question: how to make sure that SCL and SDA changes in sync?
    I am using Ubuntu Linux...
    Just change the value in one operation (so you only do ONE output to the port per change of both SCL and SDA).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Mar 2009
    Location
    DE
    Posts
    4
    Many thanks for the quick responses. I will try it to see if it works.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Parallel Port IO ops not working properly
    By microtechno in forum Linux Programming
    Replies: 16
    Last Post: 06-08-2009, 12:33 PM
  2. Replies: 3
    Last Post: 02-29-2008, 12:29 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. Segmentation Fault - Trying to access parallel port
    By tvsinesperanto in forum C Programming
    Replies: 3
    Last Post: 05-24-2006, 03:28 AM
  5. Communication over parallel port
    By Istari in forum C Programming
    Replies: 5
    Last Post: 08-25-2004, 03:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21