„Tutorial - Tiva C (EK-TM4C123GXL)” változatai közötti eltérés

Innen: apaboard
Ugrás a navigációhoz Ugrás a kereséshez
Nincs szerkesztési összefoglaló
 
(2 közbenső módosítás ugyanattól a szerkesztőtől nincs mutatva)
2. sor: 2. sor:
=== Tutorial ===
=== Tutorial ===
<big>'''[[Tutorial|Vissza az összesítő oldalra!]]'''</big>
<big>'''[[Tutorial|Vissza az összesítő oldalra!]]'''</big>
=== Program ===
<big>'''[http://eskolar.com/apa/images/1/1d/Tutorial_programs.zip Az összes program letöltése]'''</big>
=== Analóg jelek 1: TMP35 analóg hőmérő ===
=== Analóg jelek 1: TMP35 analóg hőmérő ===
Mi az '''analóg''' jel?<br />
Mi az '''analóg''' jel?<br />
8. sor: 12. sor:
A TMP35 egy lineáris hő szenzor, ahány '''°C-t''' mér annyiszor '''10 mV'''-ot kapcsol a 2. lába. <br />
A TMP35 egy lineáris hő szenzor, ahány '''°C-t''' mér annyiszor '''10 mV'''-ot kapcsol a 2. lába. <br />
[http://www.analog.com/media/en/technical-documentation/data-sheets/TMP35_36_37.pdf <big>'''TMP35 datasheet'''</big>]
[http://www.analog.com/media/en/technical-documentation/data-sheets/TMP35_36_37.pdf <big>'''TMP35 datasheet'''</big>]
==== Video ====
==== Video ====
<html>
<html>
35. sor: 40. sor:
==== Program ====
==== Program ====
<html>
<html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>/home/bkba/Dropbox/BALINT_share/energia_sketchbook/Tiva_C/Tutorial/TMP35_TivaC_TM4C123_129/TMP35_TivaC_TM4C123_129.ino</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="generator" content="Geany 1.24.1" />
<meta name="date" content="2015-08-08T13:05:30+0200" />
<style type="text/css">
body
{
font-family: Monospace, monospace;
font-size: 10pt;
}
.style_1
{
color: #d00000;
background-color: #ffffff;
}
.style_2
{
color: #d00000;
background-color: #ffffff;
}
.style_4
{
color: #007f00;
background-color: #ffffff;
}
.style_5
{
color: #00007f;
background-color: #ffffff;
font-weight: bold;
}
.style_6
{
color: #ff8000;
background-color: #ffffff;
}
.style_10
{
color: #301010;
background-color: #ffffff;
}
.style_11
{
color: #000000;
background-color: #ffffff;
}
</style>
</head>
<body>
<p>
<span class="style_1">/*&nbsp;</span><br />
&nbsp;<span class="style_1">TMP35&nbsp;read&nbsp;data&nbsp;and&nbsp;print&nbsp;to&nbsp;serial&nbsp;monitor&nbsp;in&nbsp;Celsius.</span><br />
&nbsp;<span class="style_1">Balint&nbsp;Kiss;&nbsp;2015.07.09</span><br />
&nbsp;<span class="style_1">eskolar.com</span><br />
&nbsp;<span class="style_1">--------------</span><br />
&nbsp;<br />
&nbsp;<span class="style_1">A&nbsp;TMP35&nbsp;Vout&nbsp;laban&nbsp;10&nbsp;mV&nbsp;1&nbsp;℃-nak&nbsp;felel&nbsp;meg.</span><br />
&nbsp;<span class="style_1">Ahanyszor&nbsp;10&nbsp;mV-unk&nbsp;van,&nbsp;anyi&nbsp;℃&nbsp;a&nbsp;homerseklet.</span><br />
&nbsp;<span class="style_1">Ezt&nbsp;az&nbsp;erteket&nbsp;olvassuk&nbsp;le,&nbsp;utanna&nbsp;a&nbsp;Serial&nbsp;Montor-on</span><br />
&nbsp;<span class="style_1">(soros&nbsp;porton)&nbsp;keresztul&nbsp;kirjuk.</span><br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span class="style_1">TMP35&nbsp;(front&nbsp;view)</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="style_1">|||</span><br />
&nbsp;<span class="style_1">Vin/&nbsp;|&nbsp;\GND</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="style_1">Vout</span><br />
&nbsp;<span class="style_1">*/</span><br />
<br />
<span class="style_2">//sorozat&nbsp;az&nbsp;E&nbsp;Port&nbsp;inicializalasahoz</span><br />
<span class="style_5">int&nbsp;</span><span class="style_11">E_PORT</span><span class="style_10">[]&nbsp;=&nbsp;{&nbsp;</span><br />
&nbsp;&nbsp;<span class="style_11">PE_0</span><span class="style_10">,&nbsp;</span><span class="style_11">PE_1</span><span class="style_10">,&nbsp;</span><span class="style_11">PE_2</span><span class="style_10">,&nbsp;</span><span class="style_11">PE_3</span><span class="style_10">,&nbsp;</span><span class="style_11">PE_4&nbsp;</span><span class="style_10">};</span><br />
<br />
<span class="style_5">float&nbsp;</span><span class="style_11">TMP35</span><span class="style_10">;&nbsp;</span><span class="style_2">//&nbsp;A&nbsp;szenzor&nbsp;kimente&nbsp;-&gt;&nbsp;lebegopontos&nbsp;leolvasott&nbsp;ertek</span><br />
<span class="style_5">float&nbsp;</span><span class="style_11">temp&nbsp;</span><span class="style_10">=&nbsp;</span><span class="style_4">0</span><span class="style_10">;</span><span class="style_2">//&nbsp;A&nbsp;℃&nbsp;fokba&nbsp;atalakitott&nbsp;ertek</span><br />
<span class="style_5">int&nbsp;</span><span class="style_11">sensor&nbsp;</span><span class="style_10">=&nbsp;</span><span class="style_11">PE_5</span><span class="style_10">;&nbsp;</span><span class="style_2">//leolvasott&nbsp;lab</span><br />
<br />
<span class="style_2">//inditaskor&nbsp;fut&nbsp;le</span><br />
<span class="style_5">void&nbsp;</span><span class="style_11">setup</span><span class="style_10">()&nbsp;{</span><br />
&nbsp;&nbsp;<span class="style_11">Serial</span><span class="style_10">.</span><span class="style_11">begin</span><span class="style_10">(</span><span class="style_4">9600</span><span class="style_10">);&nbsp;</span><span class="style_2">//&nbsp;Soros&nbsp;kapcsolat&nbsp;inditasa,&nbsp;baud&nbsp;rate&nbsp;beallitas</span><br />
&nbsp;&nbsp;<span class="style_11">pinMode&nbsp;</span><span class="style_10">(</span><span class="style_11">sensor</span><span class="style_10">,&nbsp;</span><span class="style_11">INPUT</span><span class="style_10">);&nbsp;</span><span class="style_2">//&nbsp;a&nbsp;leolvasott&nbsp;lab&nbsp;egy&nbsp;bemenet</span><br />
<br />
<br />
&nbsp;&nbsp;<span class="style_2">//Az&nbsp;E&nbsp;portot&nbsp;le&nbsp;kell&nbsp;zarni!</span><br />
&nbsp;&nbsp;<span class="style_2">//Mert&nbsp;PE_3&nbsp;ra&nbsp;bejövő&nbsp;jel&nbsp;(zaj)&nbsp;zavarhatja&nbsp;az&nbsp;E&nbsp;portot!</span><br />
&nbsp;&nbsp;<span class="style_5">for&nbsp;</span><span class="style_10">(</span><span class="style_5">int&nbsp;</span><span class="style_11">thisPin&nbsp;</span><span class="style_10">=&nbsp;</span><span class="style_4">0</span><span class="style_10">;&nbsp;</span><span class="style_11">thisPin&nbsp;</span><span class="style_10">&lt;&nbsp;</span><span class="style_4">5</span><span class="style_10">;&nbsp;</span><span class="style_11">thisPin</span><span class="style_10">++)&nbsp;&nbsp;{</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span class="style_11">pinMode</span><span class="style_10">(</span><span class="style_11">E_PORT</span><span class="style_10">[</span><span class="style_11">thisPin</span><span class="style_10">],&nbsp;</span><span class="style_11">OUTPUT</span><span class="style_10">);&nbsp;&nbsp;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span class="style_11">digitalWrite</span><span class="style_10">(</span><span class="style_11">E_PORT</span><span class="style_10">[</span><span class="style_11">thisPin</span><span class="style_10">],&nbsp;</span><span class="style_11">LOW</span><span class="style_10">);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><br />
&nbsp;&nbsp;<span class="style_10">}</span><br />
<span class="style_10">}</span><br />
<br />
<span class="style_2">//folyamatosan&nbsp;ismetlodik</span><br />
<span class="style_5">void&nbsp;</span><span class="style_11">loop</span><span class="style_10">()&nbsp;{</span><br />
&nbsp;&nbsp;<span class="style_2">//analog&nbsp;leolvasas&nbsp;(TM4C123&nbsp;PE_5&nbsp;=&nbsp;A8)&nbsp;(TM4C129&nbsp;PE_5&nbsp;=&nbsp;A9)&nbsp;&nbsp;</span><br />
&nbsp;&nbsp;<span class="style_11">TMP35&nbsp;</span><span class="style_10">=&nbsp;</span><span class="style_11">analogRead</span><span class="style_10">(</span><span class="style_11">PE_5</span><span class="style_10">);&nbsp;&nbsp;&nbsp;</span><br />
&nbsp;&nbsp;<span class="style_11">temp&nbsp;</span><span class="style_10">=&nbsp;((</span><span class="style_11">TMP35</span><span class="style_10">*</span><span class="style_4">3300</span><span class="style_10">)/</span><span class="style_4">4095</span><span class="style_10">)/</span><span class="style_4">10</span><span class="style_10">;</span><span class="style_2">//&nbsp;konvertalas&nbsp;mV-ba&nbsp;utanna&nbsp;℃-ba</span><br />
<br />
&nbsp;&nbsp;<span class="style_11">Serial</span><span class="style_10">.</span><span class="style_11">print</span><span class="style_10">(</span><span class="style_6">"Analog&nbsp;Read&nbsp;&nbsp;---&gt;&nbsp;&nbsp;"</span><span class="style_10">);</span><br />
&nbsp;&nbsp;<span class="style_11">Serial</span><span class="style_10">.</span><span class="style_11">print</span><span class="style_10">(</span><span class="style_11">TMP35</span><span class="style_10">);&nbsp;</span><span class="style_2">//adatok&nbsp;kiirasa</span><br />
&nbsp;&nbsp;<span class="style_11">Serial</span><span class="style_10">.</span><span class="style_11">print</span><span class="style_10">(</span><span class="style_6">"&nbsp;=&nbsp;"</span><span class="style_10">);</span><br />
&nbsp;&nbsp;<span class="style_11">Serial</span><span class="style_10">.</span><span class="style_11">print</span><span class="style_10">(</span><span class="style_11">temp</span><span class="style_10">);&nbsp;</span><span class="style_2">//adatok&nbsp;kiirasa</span><br />
&nbsp;&nbsp;<span class="style_11">Serial</span><span class="style_10">.</span><span class="style_11">println</span><span class="style_10">(</span><span class="style_6">"&nbsp;C"</span><span class="style_10">);</span><br />
&nbsp;&nbsp;<span class="style_11">delay</span><span class="style_10">(</span><span class="style_4">100</span><span class="style_10">);&nbsp;</span><span class="style_2">//&nbsp;0.1&nbsp;mp&nbsp;szunet</span><br />
<br />
<span class="style_10">}</span><br />
<br />
<br />
<br />
<br />
<br />
</p>
</body>
</html>


</html>
</html>

A lap jelenlegi, 2015. augusztus 9., 11:48-kori változata

Tutorial

Vissza az összesítő oldalra!

Program

Az összes program letöltése

Analóg jelek 1: TMP35 analóg hőmérő

Mi az analóg jel?
Hogyan tudjuk érzékelni az analóg feszültségváltozást?
A példában egy TMP35 lineáris hő szenzort használtam, hogy megértsük az analóg jeleket, ennek az értékét olvassuk le.
A TMP35 egy lineáris hő szenzor, ahány °C-t mér annyiszor 10 mV-ot kapcsol a 2. lába.
TMP35 datasheet

Video

Kapcsolás

mV to °C
TMP35 + LauchPad
TMP35 TivaC 123.png
TMP35 IC Output Voltage vs. Temperature
TMP35 kivag 02.png
TMP35 Adafruit.png
TMP35 Graph.png

Program

Digitális jelek 1

Video