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

Raspberry Pi Peripherals Library

2015-11-15
2015-11-15
  • PhilipLykov - 2015-11-15

    I want to write a library which will work with my device. My device communicates over i2c so I'm going to extend i2c FB from Raspberry Pi Peripherals Library.

    I want to communicate with my device (read and write) not only on start and on the end of the cycle so I'm not going to use the existent methods AfterReadInputs and BeforeWriteOutputs.

    I've written my own method which use 'write8' and 'read' methods. I have a i2c device which uses 3 different address for different functions so I have to communicate with different address in one cycle. But I cannot change the usiAddress on every method call, at least I cannot understand how to do it. I tried SUPER^.usiAddress:=16#69 but it didn't help.

    Then I try to use i2cMaster FB where I can indicate the usiAddress within 'write' and 'read' methods but there are no 'write8' method which is essential for me because I have to write only one register in time.

    Could you please help me to understand how to manipulate the usiAddress within my method or how to write a single register with existing 'write' method.

     
  • PhilipLykov - 2015-11-15

    Now it works fine with 'SUPER^.usiAddress:=' within my method, it seems that I have made some other mistake elsewhere.
    But I will highly appreciate if someone will point me how to write not the first register by 'write' method.

     

Log in to post a comment.