This shows you the differences between two versions of the page.
tutorials:cb1:customization:ds18b20_via_1-wire [2013/11/23 11:28] soloforce created |
tutorials:cb1:customization:ds18b20_via_1-wire [2013/12/23 14:50] (current) |
||
---|---|---|---|
Line 27: | Line 27: | ||
===== GPIO Configuration ===== | ===== GPIO Configuration ===== | ||
The kernel documents have some introduction to 1-w support, you may look into it. | The kernel documents have some introduction to 1-w support, you may look into it. | ||
- | {{ :tutorials:cb1:customization:171051gt77rzsamagr1agv.png?600 |}} | + | {{ :tutorials:cb1:customization:171051gt77rzsamagr1agv.png?500 |}} |
- | What we should do config it in script.bin. So, edit the script.fex, modify some rows like this: | + | What we should do is making 1-w support functional in script.bin. So, edit the script.fex, modify some rows like this: |
<file> | <file> | ||
[gpio_para] | [gpio_para] | ||
Line 46: | Line 46: | ||
===== Connection of DS18B20 ===== | ===== Connection of DS18B20 ===== | ||
- | DS18B20's connection is quite easy. Take the external power supply method for example, DS18B20's Vdd & Gnd pins will be connected to Cubieboard's Vcc(both 3.3v and 5.0v will be fine) & Gnd respectively, and the signal pin will be connected to the expansion pin defined in the script.fex, say, PB10(refer this:http://docs.cubieboard.org/products/a10_cubieboard/expansion_ports). And don's forget add a pull-up resistor between the signal pin and Vdd. | + | DS18B20's connection is quite easy. Take the external power supply method for example, DS18B20's Vdd & Gnd pins will be connected to Cubieboard's Vcc(both 3.3v and 5.0v will be fine) & Gnd respectively, and the signal pin will be connected to the expansion pin defined in the script.fex, say, PB10(refer this:http://docs.cubieboard.org/products/a10_cubieboard/expansion_ports). And don's forget add a pull-up 4.7KΩ resistor between the signal pin and Vdd. |
- | ===== C Codes ===== | + | ===== C Code ===== |
+ | The following code fetch temperature data from a DS18B20 in every 5 seconds, together with current localtime, and display on a 8-digits 8-segments common anode LED-displayer. This code piece depends on Cubieboard GPIO Library, you can download it {{:tutorials:cb1:customization:cubieboard_gpio_lib.tar.gz|here}}. | ||
<code c> | <code c> | ||
#include <stdio.h> | #include <stdio.h> | ||
Line 265: | Line 266: | ||
} | } | ||
</code> | </code> | ||
- | ===== DIY sample ===== | + | ===== DIY example ===== |
+ | {{ :tutorials:cb1:customization:155726ks4md4r6ird7y6xx.jpg?500 |}} | ||
+ | {{ :tutorials:cb1:customization:155732pzfqqzd4aqcmp7dq.jpg?500 |}} | ||
<WRAP noprint> | <WRAP noprint> | ||
- | {{tag>Cubieboard Cubietruck}} | + | {{tag>Cubieboard Cubieboard2 DS18B20 OneWire}} |
</WRAP> | </WRAP> |