Loading ...
Sorry, an error occurred while loading the content.

Re: [18F452] ---> Simple i2c

Expand Messages
  • atmoz2003
    Hi, Thank you for the answer. I don t know what commands I must use to send a character from master to slave. I want the slave to put on a LED if it receives
    Message 1 of 11 , Sep 1, 2005
    • 0 Attachment
      Hi,

      Thank you for the answer.

      I don't know what commands I must use to send a character from
      master to slave. I want the slave to put on a LED if it receives for
      example a "1"

      I know that the slave has a address. But I don't know how/where I
      can give the slave a address. Maybe there is a example code for the
      18F452 ?? Because all the lib's on the internet are for the F877.
      These don't work at my chip.

      It would be nice to get a example for master AND slave in JALcc for
      lighting up a remote LED via i2c. This couldn't be to hard right? If
      I get this working, than I can test further for more...

      Greetz,

      Atmoz



      --- In jallist@yahoogroups.com, mark gross <markgross@t...> wrote:
      > On Wed August 31 2005 12:35 pm, atmoz2003 wrote:
      > > Hello,
      > >
      > > Last week I started playing with i2c. The problem is that I
      don't
      > > get it working. I've made a simple setup:
      > >
      > > 2 x PIC18F452 with pins 18 (SCL) connected to both PIC's and
      pins 23
      > > (SDA) connected to both. These lines are pulluped with 1K
      resistors.
      > >
      > > In PIC "A" I do:
      > >
      > > i2c_put_start
      > > i2c_write_1(1,1)
      > > i2c_put_stop
      > >
      >
      > The i2c address your are writing to is bogus.
      >
      > This API uses the (target_device_address / 2) to get the I2C bits
      to go where
      > they need to go.
      >
      > I have a few examples of using this JAL library with some I2C
      devices.
      >
      > http://thegnar.org/mIII/JAL4MarkIII.htm look at the samples at the
      bottom of
      > the page.
      >
      > Also, this API is a bit banged implementation of I2C that doesn't
      use the HW
      > I2C engine.
      >
      > --mgross
      >
      > >
      > > In PIC "B" I do:
      > >
      > > i2c_read_1( 1, stef )
      > >
      > > if stef == 1 then led = high delay_5s led = low end if
      > >
      > >
      > > But offcourse, the LED on PIC "B" does never light...
      > >
      > > There is a lot of info on the internet about i2c and JALcc but I
      > > don't know what to use for a working setup. Please can anyone
      help
      > > me with this?
      > >
      > > Thanks in advance,
      > >
      > > Atmoz
      > >
      > >
      > >
      > >
      > >
      > >
      > > YAHOO! GROUPS LINKS
      > >
      > >
      > >  Visit your group "jallist" on the web.
      > >  
      > >  To unsubscribe from this group, send an email to:
      > >  jallist-unsubscribe@yahoogroups.com
      > >  
      > >  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
      Service.
    • Javier Martinez
      Hi all, Master I2C in a 18F452 works fine, jalethernet (jalethernet.sf.net) project have I2C library and eeprom procedures are already written:
      Message 2 of 11 , Sep 1, 2005
      • 0 Attachment
        Hi all,

        Master I2C in a 18F452 works fine, jalethernet (jalethernet.sf.net)
        project have I2C library and eeprom procedures are already written:

        http://cvs.sourceforge.net/viewcvs.py/jalethernet/sources/smalltcp/i2c_eep.jal?rev=1.1.1.1&view=markup

        ... or just take sources and look for i2c_eep.jal.


        Slave I2C it's not an easy task, since you must write a full "state
        machine" to get it working. I've a small project (I2CTerm) in jallist
        file area, uses a f876 but shouldn't be too hard to rewrite it for other
        PICs with MSSP module. IMHO, I2C slave using MSSP it's not a task for
        beginners.


        Regards,
        Javi.
      • atmoz2003
        Many thanks for this reply!! So for the Master I can use a PIC18F452. (Thanks to the link what you gave me). But for Slaves it would be better to use already
        Message 3 of 11 , Sep 1, 2005
        • 0 Attachment
          Many thanks for this reply!!

          So for the Master I can use a PIC18F452. (Thanks to the link what
          you gave me). But for Slaves it would be better to use already
          existing deveices. Such as memory EEPROM or LED Drivers working with
          i2c. That's already a start isn't it :-)

          To communicate with other PIC's I have to find something else.
          Because there isn't a library for Slave PIC's.

          Have I get this right?

          Thanks,

          Atmoz


          --- In jallist@yahoogroups.com, Javier Martinez <japus13@t...> wrote:
          > Hi all,
          >
          > Master I2C in a 18F452 works fine, jalethernet
          (jalethernet.sf.net)
          > project have I2C library and eeprom procedures are already written:
          >
          >
          http://cvs.sourceforge.net/viewcvs.py/jalethernet/sources/smalltcp/i2
          c_eep.jal?rev=1.1.1.1&view=markup
          >
          > ... or just take sources and look for i2c_eep.jal.
          >
          >
          > Slave I2C it's not an easy task, since you must write a
          full "state
          > machine" to get it working. I've a small project (I2CTerm) in
          jallist
          > file area, uses a f876 but shouldn't be too hard to rewrite it for
          other
          > PICs with MSSP module. IMHO, I2C slave using MSSP it's not a task
          for
          > beginners.
          >
          >
          > Regards,
          > Javi.
        • Javier Martinez
          Hi Atmoz, ... I ve not a library, what I ve it s a hole project: http://groups.yahoo.com/group/jallist/files/Javi%27s%20code/I2CTerm.zip ... but you re adviced
          Message 4 of 11 , Sep 1, 2005
          • 0 Attachment
            Hi Atmoz,

            > To communicate with other PIC's I have to find something else.
            > Because there isn't a library for Slave PIC's.
            >
            > Have I get this right?
            >


            I've not a library, what I've it's a hole project:

            http://groups.yahoo.com/group/jallist/files/Javi%27s%20code/I2CTerm.zip


            ... but you're adviced that it's not an easy one.

            I was with headaches during 3 months to get it working. It's still
            in a "beta" stage, for some unkown reason works perfect with a software
            driven I2C master and not so perfect with a MSSP driven I2C master.


            Regards,
            Javi.
          • atmoz2003
            Hello Javi, That s a nice and interesting project what you got there. It doen t look very easy indeed. But for only a Master (18F452) it shouldn t be to hard
            Message 5 of 11 , Sep 1, 2005
            • 0 Attachment
              Hello Javi,

              That's a nice and interesting project what you got there. It doen't
              look very easy indeed. But for only a Master (18F452) it shouldn't
              be to hard to use. (i2c_eep.jal). Programming a slave with a PIC is
              to heavy. I think I go test around with a Master PIC and the rest
              slave already existing IC's.

              For example: interface a i2c EEPROM or the PCA9531 (i2c RGB LED
              DRIVER) with my PIC shouldn't be that hard is it? (when using
              i2c_eep.jal)

              First off all I have to buy some IC's that work with i2c. I've a lot
              of IC's here, but none of them working with the i2c bus...

              Just one question: when using the i2c_eep.jal libray, I can
              communicate with other IC's then only EEPROM isn't it?

              Greetz,

              Atmoz



              --- In jallist@yahoogroups.com, Javier Martinez <japus13@t...> wrote:
              > Hi Atmoz,
              >
              > > To communicate with other PIC's I have to find something else.
              > > Because there isn't a library for Slave PIC's.
              > >
              > > Have I get this right?
              > >
              >
              >
              > I've not a library, what I've it's a hole project:
              >
              > http://groups.yahoo.com/group/jallist/files/Javi%27s%
              20code/I2CTerm.zip
              >
              >
              > ... but you're adviced that it's not an easy one.
              >
              > I was with headaches during 3 months to get it working. It's
              still
              > in a "beta" stage, for some unkown reason works perfect with a
              software
              > driven I2C master and not so perfect with a MSSP driven I2C
              master.
              >
              >
              > Regards,
              > Javi.
            • Javier Martinez
              Hi Atmoz, The library have 2 sections, one that manages raw data through master I2C and the second one that uses previous procedures to implement EEPROM read
              Message 6 of 11 , Sep 1, 2005
              • 0 Attachment
                Hi Atmoz,

                The library have 2 sections, one that manages "raw data" through
                master I2C and the second one that uses previous procedures to implement
                EEPROM read & write. You can write your own procedures to manage other
                I2C slave devices in the same way that eeprom ones.


                Regards,
                Javi.



                > Just one question: when using the i2c_eep.jal libray, I can
                > communicate with other IC's then only EEPROM isn't it?
                >
                > Greetz,
                >
                > Atmoz
                >
              • Snail Instruments
                ... First try to answer what your goal is. Do you need to transmit information over distance? I2C is not a good solution in this case. For several reasons. Do
                Message 7 of 11 , Sep 1, 2005
                • 0 Attachment
                  >To communicate with other PIC's I have to find something else.
                  >Because there isn't a library for Slave PIC's.

                  First try to answer what your goal is. Do you need to transmit information
                  over distance? I2C is not a good solution in this case. For several reasons.

                  Do you need two PICs on the same board (or same box, simply at short
                  distance) to communicate to each other? Here I2C is acceptable, but there
                  could be better solution - USART, SPI.

                  Josef
                Your message has been successfully submitted and would be delivered to recipients shortly.