Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

I2C muxing library

Stefan2
2017-11-17
2024-03-01
  • Stefan2 - 2017-11-17

    3S Moderator:
    thanks for sharing this added to CODESYS V3 Raspberry Pi share your devices & libraries & applications
    l viewtopic.php?f=23&t=5872&p=18200#p19664 l

    Hello,

    Here is my Library for some I2C devices for CODESYS.
    You can place all devices behind a multiplexer to reduce address conflicts.
    Although include the BME280 Environment sensor and an SD1306 Display Driver.
    Look at google for these little funny Displays.
    All fonts are working on the display, but not the biggest. There the bits have to be twisted.
    If you find any problems, tell me, the Drives have not been tested all.

    Don't look at the documentation, there is none ... .

    In the I2C_Base FB I did write some info’s for the muxing.

    With the muxing IC you can connect about 33554432 BME280 on the raspi, but then bus cycle time is no longer a problem .

    You will need the OSCAT building lib to compile. i can not uplode it here like the OSCAT BASIC lib(to big), so try the lib from the store.

    Device list:

    BME280
    25C512 64KiB EEPROM
    An 4channel dimmer (I done this for an friend)
    PCA9555 as 16 bit input
    PCA9555 as 16 bit output
    PCA9685 a 16 channel 12bit PWM output, inspired by example code of CODESYS but writes only when output value is changing
    PCF8575 as 16 bit input
    PCF8575 as 16 bit output
    SSD1306 Display Driver
    TCA9548 8 channel I2C Multiplexer/switch
    TSL2561 lux sensor, state I would say experimental

    Greetings Stefan

    xml devices.zip [18.38 KiB]

    Raspberry I2C MUX.projectarchive [388.84 KiB]

    BASIC.projectarchive [398.68 KiB]

     
    πŸ‘
    1
  • Stefan2 - 2017-11-17

    Hi,

    forgot the xml's

    Greetings

    xml devices.zip [18.38 KiB]

     
  • Anonymous - 2020-02-12

    Originally created by: PhilouG

    Hello,
    I'm using Codesys V3.5 SP15 patch3 with a raspberry pi.
    I have installed the OSCAT basic and building package, the I2C MUX library and the BME280.xml.
    I have a message error : the library Β« #CommonTypsFunctions Β» can't be opened.
    Can you help me?
    Best regards
    Philippe

     
  • FabioPD - 2020-07-20

    Hello Stafan
    I have to use TCA9548 with 2 SHT21.. What aI have to do to configure it?
    I tried to set 1 slave, changed ID from 0x77 to 0x70.
    But How to read my slaves? thank you

     

Log in to post a comment.