<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Reading DS18B20 via DS2482-800</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/e43ab64335/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Runtime/thread/e43ab64335/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Runtime/thread/e43ab64335/</id><updated>2020-02-27T17:15:16.197000Z</updated><subtitle>Recent posts to Reading DS18B20 via DS2482-800</subtitle><entry><title>Reading DS18B20 via DS2482-800</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/e43ab64335/?limit=25#f5d5" rel="alternate"/><published>2020-02-27T17:15:16.197000Z</published><updated>2020-02-27T17:15:16.197000Z</updated><author><name>Ingo</name><uri>https://forge.codesys.com/u/ingo/</uri></author><id>https://forge.codesys.comf8d0fada0cde90432982bc7549d85c199453409d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Nice that you found it already. If you like to turn your library into a real I/O driver afterwards, please take a look at &lt;a class="" href="https://forge.codesys.com/drv/io-drivers/"&gt;https://forge.codesys.com/drv/io-drivers/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Have fun, and if you have further questions regarding generic I/O stuff feel free to ask.&lt;/p&gt;
&lt;p&gt;And if you like to share your work, forge.codesys.com is a good place for that. &lt;/p&gt;
&lt;p&gt;Gesendet von meinem LG-H870 mit Tapatalk&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Reading DS18B20 via DS2482-800</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/e43ab64335/?limit=25#b61e" rel="alternate"/><published>2020-02-27T17:15:13.449000Z</published><updated>2020-02-27T17:15:13.449000Z</updated><author><name>Schmittlich</name><uri>https://forge.codesys.com/u/schmittlich/</uri></author><id>https://forge.codesys.com1e74a17ba73cfe6fc6e7ad785d78f795738873e1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;OK, in meantime I found the first important trick how to use the "low-level" comands.&lt;br/&gt;
Add I2C-Master and then use following syntax inside the program:&lt;/p&gt;
&lt;p&gt;byWrite:=i2c_master.write(16#20, ADR(byOut), 1); //Using a PCF8574&lt;br/&gt;
byRead:=i2c_master.read(16#20, ADR(byIn), 1); //Using a PCF8574&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Reading DS18B20 via DS2482-800</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/e43ab64335/?limit=25#cab3" rel="alternate"/><published>2020-02-27T17:15:12.465000Z</published><updated>2020-02-27T17:15:12.465000Z</updated><author><name>Schmittlich</name><uri>https://forge.codesys.com/u/schmittlich/</uri></author><id>https://forge.codesys.comb31ffae4f89a299a5290089c77d4750b38ac58f4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello, I am mew with CODESYS&lt;br/&gt;
But I do have experience with TwinCAT 2&lt;/p&gt;
&lt;p&gt;I want to read temperature from 8x DS2482 via I2C.&lt;br/&gt;
On one port of DS2482-800 only one DS18B20 - so they can be replaced without changing the ID of the DS18B20.&lt;br/&gt;
Therfore I want to create a simple Library for the DS2482-800&lt;/p&gt;
&lt;p&gt;With a MICROCHIP-PIC I can already read the DS18B20.&lt;br/&gt;
Now I want to do the same with CODESYS on the Raspberry 3&lt;/p&gt;
&lt;p&gt;Can anyone assist me, in this project?&lt;br/&gt;
As a first step, I would be happy to create some Functions to acces the DS2482.&lt;br/&gt;
But right now, I have proplems to use the low-level comands like write8 or read8 I2C-comands inside a regular Function block.&lt;/p&gt;
&lt;p&gt;Lets start with the first step ... sending a reset to the DS2482&lt;/p&gt;
&lt;p&gt;This is, how I dit it with my PIC16F887:&lt;br/&gt;
' Returns: TRUE if device was reset&lt;br/&gt;
'          FALSE device not detected or failure to perform reset&lt;br/&gt;
'&lt;br/&gt;
Function ds2482_reset() As Bit&lt;br/&gt;
Dim xstatus As Byte&lt;br/&gt;
Dim acknowledge As Bit&lt;br/&gt;
    ds2482_reset = False&lt;br/&gt;
    '// device reset&lt;br/&gt;
    I2CWrite1 sda, scl, i2c_addressw, cmd_drst&lt;br/&gt;
    WaitUs 10&lt;br/&gt;
    I2CRead1 sda, scl, i2c_addressr, xstatus&lt;br/&gt;
    '// check For failure due To incorrect Read back of STATUS&lt;br/&gt;
    xstatus = xstatus And 0xf7&lt;br/&gt;
    If xstatus = 0x10 Then ds2482_reset = True&lt;br/&gt;
End Function&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>