o: ActiveSupport::Cache::Entry :@compressedF: @value"׳"г
Designs/GPSRL01A/DOC/HTML/GPSRL01A.cs.html
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
<html>
3
  <head>
4
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
    <title> GPSRL01A </title>
6
    <meta name="keywords" content="stavebnice MLAB zapisovač kosmické záření GPS ">
7
    <meta name="description" content="Projekt MLAB, Zapisovač intenzity kosmického záření využívající GPS">
8
    <!-- AUTOINCLUDE START "Page/Head.cs.ihtml" DO NOT REMOVE -->
9
    <link rel="StyleSheet" href="../../../../Web/CSS/MLAB.css" type="text/css" title="MLAB základní styl">
10
    <link rel="StyleSheet" href="../../../../Web/CSS/MLAB_Print.css" type="text/css" media="print">
11
    <link rel="shortcut icon" type="image/x-icon" href="../../../../Web/PIC/MLAB.ico">
12
    <script type="text/javascript" src="../../../../Web/JS/MLAB_Menu.js"></script>
13
    <!-- AUTOINCLUDE END -->
14
  </head>
15

  
16
  <body lang="cs">
17

  
18
    <!-- AUTOINCLUDE START "Page/Header.cs.ihtml" DO NOT REMOVE -->
19
    <!-- ============== HLAVICKA ============== -->
20
    <div class="Header">
21
      <script type="text/javascript">
22
      <!--
23
        SetRelativePath("../../../../");
24
        DrawHeader();
25
      // -->
26
      </script>
27
      <noscript>
28
        <p><b> Pro zobrazení (vložení) hlavičky je potřeba JavaScript </b></p>
29
      </noscript>
30
    </div>
31
    <!-- AUTOINCLUDE END -->
32

  
33
    <!-- AUTOINCLUDE START "Page/Menu.cs.ihtml" DO NOT REMOVE -->
34
    <!-- ============== MENU ============== -->
35
    <div class="Menu">
36
      <script type="text/javascript">
37
      <!--
38
        SetRelativePath("../../../../");
39
        DrawMenu();
40
      // -->
41
      </script>
42
      <noscript>
43
        <p><b> Pro zobrazení (vložení) menu je potřeba JavaScript </b></p>
44
      </noscript>
45
    </div>
46
    <!-- AUTOINCLUDE END -->
47

  
48
    <!-- ============== TEXT ============== -->
49
    <div class="Text">
50
      <p class="Title">
51
        Zapisovač intenzity kosmického záření
52
      </p>
53
      <p class=Autor>
54
        Jakub Kákona
55
      </p>
56
      <p class="Subtitle">
57
        Zapisovač intensity ionisačního záření umožňuje systematický sběr dat vázaný na zeměpisné souřadnice. Například během letu v letadle.
58
      </p>
59
      <p class="Subtitle">
60
        <img width=291 height=218 src="pictures/image001_small.jpg"
61
         alt="Obrázek radiačního záznamníku">
62
      </p>
63

  
64
      <h1> Technické parametry </h1>
65

  
66
      <table>
67
        <tr>
68
          <th> Parametr </th>
69
          <th> Hodnota </th>
70
          <th> Poznámka </th>
71
        </tr>
72
        <tr>
73
          <td> Napájení </td>
74
          <td> 5V </td>
75
          <td> 4x 1,2V Ni-MH acu.</td>
76
        </tr>
77
        <tr>
78
          <td> Spotřeba v klidu </td>
79
          <td> cca 20mA </td>
80
          <td> bez Palmtopu </td>
81
        </tr>
82
        <tr>
83
          <td> Komunikace </td>
84
          <td> 2x sériová linka RS-232 </td>
85
          <td> </td>
86
        </tr>
87
        <tr>
88
          <td> Komunikace s GPS </td>
89
          <td> NMEA </td>
90
          <td> sériová linka RS-232</td>
91
        </tr>
92
      </table>
93

  
94
      <h1> Popis konstrukce </h1>
95

  
96
      <h2> Důvod vzniku </h2>
97

  
98
      <p>
99
        Tento zapisovač byl vyvinut během Fyzikálního Týdne na FJFI ČVUT v Praze. Za účelem použití v miniprojektu Stanovení radiační zátěže od kosmického záření na palubě letadla.
100
      </p>
101

  
102
      <p>
103
        Zařízení je z části postaveno z modulů stavebnice (kromě Palmtopu, do kterého se ukládají data a samotného detektoru radiace.) Celý zapisovač funguje vlastně jako komprimátor dvou datových toků, jednak z GPS geko 201 a potom ze scintilačního detektoru NB 3201 a případně z intezimetru IT-65.
104
      </p>
105

  
106

  
107
      <h2> Zapojení modulů zapisovače </h2>
108

  
109
      <p>
110
        <img src="../../SCH/GPSRL.png" width="680" height="271">
111
      </p>
112
      <p>
113
        Modul PIC16F84SO1801A je osazen procesorem PIC16F88, protože je potřeba A/D převodník pro zpracování logaritmického analogového signálu ze scintilátoru NB 3201. Připojení intenzimetru IT-65 je provedeno tak, že pulsy se z konektoru přivádí přímo na komparátor v procesoru a z něj do čítače odkud se programově čtou.
114
      </p>
115
      <h3>Snímací prvky</h3>
116
      <p>
117
      <a href="http://www.mlab.cz/WebSVN/filedetails.php?repname=MLAB&path=%2FDesigns%2FGPSRL01A%2FDOC%2Fdokumentace_NB_3201.zip">Dokumentace ke scintilačnímu detektoru NB 3201</a></p>
118
      <p>Intensimetr IT-65:</p>
119
      <a href="pictures/P5290002.JPG"><img src="pictures/P5290002_small.JPG" alt="" width="267" height="200"></a>
120
      <a href="pictures/P5290003.JPG"><img src="pictures/P5290003_small.JPG" alt="" width="267" height="200"></a>
121
      <h2> Program </h2>
122

  
123
      <p>
124
        Původní zdrojový kód od celého zařízení se mi někam záhadně ztratil Doufám, že ho ale ještě někde objevím, protože i přes jeho jednoduchost byl docela pracný.
125
      </p>
126
      <p>Program pracoval tak, že periodicky četl textový výstup z GPS přijímače a do něj doplňoval naměřenou hodnotu z čítače, nebo A/D převodníku.</p>
127
      <p>
128
        Výsledný datový soubor ukládaný v palmtopu pak vypadal takto: <br>
129
        [datum a čas]N[souřadnice]E[souřadnice]G[intenzita]+[nadmořská výška]E0000N0000U0001*[číslo packetu]
130
      </p>
131
      <p>
132
        060613081217N4943072E01405835G008+00465E0000N0000D0000*0019<br>
133
        060613081222N4943072E01405835G008+00462E0000N0000U0000*0033<br>
134
        060613081227N4943072E01405835G008+00461E0000N0000U0000*0030<br>
135
        060613081232N4943072E01405835G008+00462E0000N0000U0001*0025<br>
136
        060613081237N4943072E01405835G008+00461E0000N0000U0001*0024<br>
137
        060613081242N4943072E01405835G008+00462E0000N0000U0001*0028<br>
138
        060613081247N4943072E01405835G008+00462E0000N0000U0001*0029<br>
139
        060613081252N4943072E01405835G008+00461E0000N0000U0001*0034<br>
140
      </p>
141
      <p>
142
        
143
      </p>
144

  
145
      
146
    </div>
147

  
148
    <!-- AUTOINCLUDE START "Page/Footer.cs.ihtml" DO NOT REMOVE -->
149
    <!-- ============== PATIČKA ============== -->
150
    <div class="Footer">
151
      <script type="text/javascript">
152
      <!--
153
        SetRelativePath("../../../../");
154
        DrawFooter();
155
      // -->
156
      </script>
157
      <noscript>
158
        <p><b> Pro zobrazení (vložení) hlavičky je potřeba JavaScript </b></p>
159
      </noscript>
160
    </div>
161
    <!-- AUTOINCLUDE END -->
162

  
163
  </body>
164
</html>
Designs/GPSRL01A/PrjInfo.txt
1
//
2
// Toto je popisný soubor pro popis obsahu adresáře (příklad)
3
//
4

  
5
[InfoShortDescription.en]
6
  Ionisation Radiation Logger
7

  
8
[InfoShortDescription.cs]
9
  Zapisovač intenzity kosmického záření
10
  
11
[InfoLongDescription.en]
12
  Logger is an application developed during the "Physics' Day" 
13
  organised for secondary school students at the Faculty of 
14
  Nuclear Sciences and Physical Engineering in Prague.
15
  It can log intensity of ionising radiation with GPS coordinates.
16

  
17
[InfoLongDescription.cs]
18
  Zapisovač intensity ionizačního záření umožňuje systematický sběr 
19
  dat vázaný na zeměpisné souřadnice. Například během letu v letadle.
20
  Jedná se o experiment z Fyzikálního týdne pro středoškoláky na 
21
  FJFI ČVUT.
22

  
23
[End]
Designs/GPSRL01A/SCH/GPSRL.svg
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<!-- Created by diasvg.py -->
3
<svg width="34.000cm" height="13.550cm" viewBox="12.600 6.800 46.600 20.350"
4
 xmlns="http://www.w3.org/2000/svg"
5
 xmlns:xlink="http://www.w3.org/1999/xlink">
6
<rect x="17.450" y="10.850" width="7.450" height="4.500" fill="#FFFFFF" stroke="none" stroke-width="0"/>
7
<rect x="17.450" y="10.850" width="7.450" height="4.500" fill="none" stroke="#000000" stroke-width="0.100" />
8
<rect x="12.650" y="11.800" width="2.700" height="2.700" fill="#FFFFFF" stroke="none" stroke-width="0"/>
9
<rect x="12.650" y="11.800" width="2.700" height="2.700" fill="none" stroke="#000000" stroke-width="0.100" />
10
<rect x="29.500" y="11.000" width="7.150" height="4.350" fill="#FFFFFF" stroke="none" stroke-width="0"/>
11
<rect x="29.500" y="11.000" width="7.150" height="4.350" fill="none" stroke="#000000" stroke-width="0.100" />
12
<rect x="31.950" y="18.150" width="2.150" height="2.150" fill="#FFFFFF" stroke="none" stroke-width="0"/>
13
<rect x="31.950" y="18.150" width="2.150" height="2.150" fill="none" stroke="#000000" stroke-width="0.100" />
14
<rect x="40.650" y="10.250" width="5.900" height="5.900" fill="#FFFFFF" stroke="none" stroke-width="0"/>
15
<rect x="40.650" y="10.250" width="5.900" height="5.900" fill="none" stroke="#000000" stroke-width="0.100" />
16
<line x1="15.350" y1="13.150" x2="17.226" y2="13.105" stroke="#000000" stroke-width="0.100" />
17
<polyline fill="none" stroke="#000000" stroke-width="0.100"  points="16.844,13.364 17.338,13.103 16.832,12.865 "/>
18
<line x1="33.075" y1="13.175" x2="33.075" y2="13.175" stroke="#000000" stroke-width="0.100" />
19
<line x1="24.950" y1="12.000" x2="29.177" y2="11.953" stroke="#000000" stroke-width="0.100" />
20
<polyline fill="none" stroke="#000000" stroke-width="0.100"  points="28.791,12.207 29.288,11.951 28.786,11.707 "/>
21
<line x1="25.159" y1="13.998" x2="29.386" y2="13.951" stroke="#000000" stroke-width="0.100" />
22
<polyline fill="none" stroke="#000000" stroke-width="0.100"  points="25.545,13.744 25.047,13.999 25.550,14.244 "/>
23
<line x1="33.071" y1="15.574" x2="33.025" y2="18.150" stroke="#000000" stroke-width="0.100" />
24
<polyline fill="none" stroke="#000000" stroke-width="0.100"  points="33.314,15.966 33.073,15.462 32.814,15.957 "/>
25
<line x1="36.650" y1="13.175" x2="40.426" y2="13.199" stroke="#000000" stroke-width="0.100" />
26
<polyline fill="none" stroke="#000000" stroke-width="0.100"  points="40.037,13.446 40.538,13.199 40.040,12.946 "/>
27
<text x="33.075" y="13.250"  fill="#000000" text-anchor="middle" font-size="0.80" font-family="sans" font-style="normal" font-weight="400">
28
RS232SINGLE01A</text>
29
<text x="33.025" y="19.291"  fill="#000000" text-anchor="middle" font-size="0.80" font-family="sans" font-style="normal" font-weight="400">
30
GPS</text>
31
<text x="43.600" y="13.200"  fill="#000000" text-anchor="middle" font-size="0.80" font-family="sans" font-style="normal" font-weight="400">
32
Palmtop</text>
33
<text x="37.500" y="12.750"  fill="#000000" text-anchor="start" font-size="0.80" font-family="sans" font-style="normal" font-weight="400">
34
RS232</text>
35
<text x="33.500" y="17.150"  fill="#000000" text-anchor="start" font-size="0.80" font-family="sans" font-style="normal" font-weight="400">
36
RS232</text>
37
<text x="26.700" y="11.500"  fill="#000000" text-anchor="start" font-size="0.80" font-family="sans" font-style="normal" font-weight="400">
38
TXD</text>
39
<text x="26.800" y="13.600"  fill="#000000" text-anchor="start" font-size="0.80" font-family="sans" font-style="normal" font-weight="400">
40
RXD</text>
41
<text x="21.175" y="13.166"  fill="#000000" text-anchor="middle" font-size="0.80" font-family="sans" font-style="normal" font-weight="400">
42
PIC16F84SO1801A</text>
43
<text x="14.000" y="13.216"  fill="#000000" text-anchor="middle" font-size="0.80" font-family="sans" font-style="normal" font-weight="400">
44
IT-65</text>
45
<rect x="19.235" y="6.850" width="3.965" height="1.850" fill="#FFFFFF" stroke="none" stroke-width="0"/>
46
<rect x="19.235" y="6.850" width="3.965" height="1.850" fill="none" stroke="#000000" stroke-width="0.100" />
47
<line x1="21.218" y1="8.700" x2="21.179" y2="10.626" stroke="#000000" stroke-width="0.100" />
48
<polyline fill="none" stroke="#000000" stroke-width="0.100"  points="20.937,10.233 21.177,10.738 21.437,10.243 "/>
49
<text x="21.218" y="7.850"  fill="#000000" text-anchor="middle" font-size="0.80" font-family="sans" font-style="normal" font-weight="400">
50
NB 3201</text>
51
</svg>
Designs/GPSRL01B/SW/gpsrl.hex
1
:1000000000308A00642A00000A108A100A11820750
2
:1000100028340C34013406340A108A100A1182077D
3
:1000200047345034533452344C3430343134423405
4
:1000300020340A3400340A108A100A118207283446
5
:100040006334293420344B3461346B346C34693478
6
:100050006B342034323430343034383400340A10C5
7
:100060008A100A1182070C340034CE308400000854
8
:10007000031949280130F800F701F70B3D28F80B68
9
:100080003C284A30F700F70B432800000000800BA3
10
:100090003A28003406080F398316D500540EF700AD
11
:1000A000F030F7057708F0395504831286000615FD
12
:1000B000831606112130F700F70B5C288312061116
13
:1000C00083160611831200348316D208031D6C2890
14
:1000D000831286106E288316831286148316861068
15
:1000E000D30E5308D40083124A208316D30E53082C
16
:1000F000D40083124A204230F700F70B7D2800001D
17
:10010000003414308316CE00831235200F3083164E
18
:1001100086058312861083168610831206118316B5
19
:100120000611CC014C08023C031CA2280230CE0070
20
:100130008312352003308316D40083124A2083169D
21
:10014000CC0A92280D30F700F70BA4280230D40017
22
:1001500083124A200D30F700F70BAC288316CC0130
23
:100160004C08023C031CC6284C088312042083164A
24
:10017000CD00D2014D08D3008312642002308316D3
25
:10018000CE00831235208316CC0AB02883128A1140
26
:100190000A12C72A013083164F02FC3E0318E328D7
27
:1001A000043E8312EF288316D001E32840308316E3
28
:1001B000D000E32814308316D000E328543083168F
29
:1001C000D000E328831601304E02D0075008803853
30
:1001D000D100D2015108D3008312642000340A10E8
31
:1001E0008A100A118207D328D628DA28DE28831637
32
:1001F0004D080C3A831203190729063A03191329EB
33
:10020000073A03191B29053A0319222929298316BC
34
:10021000D2010130D3008312642002308316CE0055
35
:1002200083123520372901308316CE000230CF00EB
36
:100230008312CA20372901308316CE00CF008312E3
37
:10024000CA2037298316D2011030D30083126420CC
38
:10025000372983164D081F3C031C30290730CD0574
39
:100260000130D2004D08D3008312642037290034B6
40
:100270000830F70020172008831687008312071F15
41
:10028000432983163E298316CF01F7175729F71301
42
:10029000572903108312071B03148316CF0C7717FB
43
:1002A00057297713F70B49294F08F80062293F3087
44
:1002B000F71B1130F800F80B5B29F71B4729771B58
45
:1002C000512949298312003483164D08CF004F0865
46
:1002D0008400800803196E29CF0A67294E0884001C
47
:1002E000800803197E294E0884000008D1004F08B9
48
:1002F000840051088000CF0ACE0A6E294F0884007E
49
:1003000080014D08F80083120034A01320088316E2
50
:100310008700831287130830F800000000000000F7
51
:10032000F817A329F8138316D50C8312031887171F
52
:10033000031C87137817A3297813F80B932900005F
53
:100340000000000087171C308400840BA5290000E2
54
:100350000000F81B9229781B9C2900348316500852
55
:10036000F8014F020318B7294F08F700C329F70116
56
:100370000830D100CF0DF70D500877020318F700B1
57
:10038000F80DD10BBA2983120034780883164D0872
58
:10039000CF006430D0008312AE2177088316CD00E1
59
:1003A00078083030031DDB29CE1CE429CE19E4295E
60
:1003B0004E1A2030DE29CE114E124E14F80778085E
61
:1003C000D5008312852183164D08CF000A30D00056
62
:1003D0008312AE2177088316CD0078083030031DD4
63
:1003E000F729CE19FD294E1CFD294E1A2030F80799
64
:1003F0007808D5008312852183163030CD074D084B
65
:10040000D500831285218A110A12822C04088316D2
66
:10041000D4004E0EF038D000D007E23ED100323E7C
67
:10042000D3004E080F39D107D107D307E93ED200D8
68
:10043000D207D2074D0E0F39D207D307D20DD30DF5
69
:10044000D309D30D4D080F39D307D00D0730CF0096
70
:100450000A30D307D203031C292AD207D103031C75
71
:100460002D2AD107D003031C312AD007CF03031C48
72
:10047000352ACF3084000730540554138407D33015
73
:100480000402031954170008F700031D4F2A541BD8
74
:100490004F2A541A5D2AD4194F2A2030522AD415D3
75
:1004A00054123030F707CE010408CD007708D5008C
76
:1004B0008312852183164D088400840A541F3F2A25
77
:1004C00083128A110A12922CA701D730A600163087
78
:1004D0008316D700D901D801831284011F30830508
79
:1004E0008316051083120514A013200883168700B5
80
:1004F0008312871783161F149F141F159F1107302F
81
:100500009C00FF308312A000A1010130A200A301D2
82
:10051000A401A50183161F109F141F159F151F13FB
83
:1005200083121F179F1783169F1783121F1494128D
84
:10053000A012200883168700831220162008831635
85
:1005400087008312A01120088316870000308312D1
86
:100550009400831694000108C7390838810083127B
87
:1005600090010030F80092000030831692000730AE
88
:100570009C0005080330F700F70BBC2A1C08831207
89
:100580000D13FE3083169D000515831281286430FB
90
:100590008316CE008312352005308316CE0001303D
91
:1005A000CF008312CA20E80168080C200038031924
92
:1005B000DF2AE80A8316CD008312F720D42AE80147
93
:1005C00068081B2000380319EB2AE80A8316CD00BF
94
:1005D0008312F720E02A0230E80096308316CE001E
95
:1005E00083123520E80BED2AE80168082F20003837
96
:1005F0000319002BE80A8316CD008312F720F52A91
97
:100600000830F8001F08C73978049F00BB01CF01EC
98
:10061000E3018316B301C701831238217808243C13
99
:100620000319142B83160C2B1F151F19152B83165A
100
:100630001E088312E5001E08E6002430A8000130E1
101
:10064000E4006408123C031C302B2830640784004B
102
:10065000E90038216908840078088000E40A212B29
103
:10066000E4016408123C031C402B3C306407840006
104
:10067000E90038216908840078088000E40A312BF9
105
:10068000E4016408123C031C502B503064078400C2
106
:10069000E90038216908840078088000E40A412BC9
107
:1006A000E4016408123C031C772B38217808E7002A
108
:1006B00067082A3C031D702BA0306407840080016A
109
:1006C00067088316B4008312382178088316B500B2
110
:1006D0008312382178088316B600B701AA2B83123B
111
:1006E000A0306407840067088000E40A512BE4010D
112
:1006F0006408123C031CA92B38217808E70067081E
113
:100700002A3C031DA22BB4306407840067088000D4
114
:1007100001306407B43E8400EA0038216A0884008E
115
:100720007808800002306407B43E8400EA00382173
116
:100730006A0884007808800003306407B43E8400AF
117
:100740008001A92BB4306407840067088000E40AA4
118
:10075000782B83168312E80168082F2000380319CC
119
:10076000B72BE80A8316CD008312F720AC2B201498
120
:1007700020088316870083120718EC2B013083169C
121
:10078000CE00CF008312CA2028308400003000043D
122
:100790000319D52B0408E80000088316CD00831246
123
:1007A000F72068088400840AC62B0A308316CD001F
124
:1007B0008312F7203C308400003000040319EB2B37
125
:1007C0000408E80000088316CD008312F7206808AB
126
:1007D0008400840ADC2B192C01308316CE00CF0054
127
:1007E0008312CA2050308400003000040319032C07
128
:1007F0000408E80000088316CD008312F72068087B
129
:100800008400840AF42B0A308316CD008312F7206B
130
:10081000A0308400003000040319192C0408E800FB
131
:1008200000088316CD008312F72068088400840A2C
132
:100830000A2C3C308316CD005030CE008312642148
133
:100840007808E80028308316CD00831278088316D4
134
:10085000CE00831264217808E9008400003000048F
135
:1008600003193D2C0408EA0000088316D500831202
136
:1008700085216A088400840A2E2C0D308316D50049
137
:10088000831285210A308316D50083128521A0307A
138
:100890008316CD00B430CE00831264217808E800BE
139
:1008A0008400003000040319602C0408E9000008EB
140
:1008B0008316D5008312852169088400840A512C8F
141
:1008C0000D308316D500831285210A308316D5009A
142
:1008D000831285218316051600308312051A013014
143
:1008E000E80020308316D500831285212F3083162F
144
:1008F000D5008312852168088316CD001B30CE00F9
145
:100900008312C5292F308316D5008312852110301C
146
:10091000840066088316CE00831265088316CD0016
147
:100920008312062A0A308316D500831285210D30E2
148
:0C0930008316D50083128521062B63007E
149
:02400E00393F38
150
:00000001FF
151
;PIC16F876A
Designs/GPSRL01B/SW/gpsrl.h
1
#include <16F876A.h>
2
#device adc=10
3

  
4
#FUSES NOWDT                 	//No Watch Dog Timer
5
#FUSES XT                    	//Osc (= 4mhz)
6
#FUSES NOPUT                 	//No Power Up Timer
7
#FUSES NOPROTECT             	//Code not protected from reading
8
#FUSES NODEBUG               	//No Debug mode for ICD
9
#FUSES NOBROWNOUT            	//No brownout reset
10
#FUSES NOLVP                 	//No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
11
#FUSES NOCPD                 	//No EE protection
12
#FUSES NOWRT                 	//Program memory not write protected
13

  
14
#use delay(clock=4000000)
15
#use rs232(stream=NMEA,baud=4800,parity=N,rcv=PIN_C6,bits=8)
16
#use rs232(stream=PC,baud=9600,parity=N,xmit=PIN_C7,bits=8)
Designs/GPSRL01B/SW/gpsrl.c
1
/**** GPS skrysohledac ****/
2
#define ID "$Id: gps.c 984 2008-01-06 23:41:31Z kakl $"
3

  
4
#include "gpsrl.h"
5

  
6
#include <math.h>
7
#include <stdlib.h>
8
#include <stdlibm.h>
9

  
10
#define  SCINTILAK   1           //kanal adc pro scintilacni detektor NB3201
11
#define  RANGE       PIN_A4      // vystup detektoru urcujici rozsah mereni.
12

  
13

  
14
#define  LCD_RS         PIN_B1      // LCD control
15
#define  LCD_E          PIN_B2      // LCD enable
16
#define  LCD_DATA_LSB   PIN_B4      // LSB data bit LCD
17
#include "MYLCD.C"
18

  
19
#define  TL1   PIN_C0
20
#define  TL2   PIN_C1
21
#define  TL3   PIN_C2
22

  
23
//$GPRMC,105815.503,V,4915.5877,N,01442.3896,E,0.0,0.00,060108,,,N*44
24
//$GPGGA,000415.000,4915.6225,N,01442.3608,E,1,03,50.0,409.6,M,45.2,M,0.0,0000*48
25
void main()
26
{
27

  
28
   setup_adc_ports(AN0);
29
   setup_adc(ADC_CLOCK_INTERNAL);
30
   setup_spi(FALSE);
31
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
32
   setup_timer_1(T1_DISABLED);
33
   setup_timer_2(T2_DISABLED,0,1);
34
   setup_comparator(NC_NC_NC_NC);
35
   setup_vref(VREF_LOW|-2);
36
   lcd_init();
37

  
38
   delay_ms(100);
39
   lcd_gotoxy(5,1);
40
   printf(lcd_putc,"GPSRL01B \n");
41
   printf(lcd_putc,"(c) Kaklik 2008");
42
   delay_ms(300);
43
   printf(lcd_putc,"\f");
44

  
45
   set_adc_channel(SCINTILAK);
46

  
47
   while(TRUE)
48
   {
49

  
50

  
51
   char tab1[20];
52
   char tab2[20];
53
   char tab3[20];
54
   char tab4[20];
55
   char tab5[20];
56

  
57
   int8  n;
58
   int16 intensity;
59
   char  c;
60

  
61
      tab1[19]=0;
62
      tab2[19]=0;
63
      tab3[19]=0;
64
      tab4[19]=0;
65
      tab5[19]=0;
66

  
67
      while(fgetc(NMEA)!='$');            // Waiting for start character
68

  
69
      intensity=read_adc();
70
      tab1[0]='$';
71
      
72
      for(n=1;n<(19);n++)
73
      {
74
         tab1[n]=fgetc(NMEA);
75
      };
76

  
77
      for(n=0;n<(19);n++)
78
      {
79
         tab2[n]=fgetc(NMEA);
80
      };
81

  
82
      for(n=0;n<(19);n++)
83
      {
84
         tab3[n]=fgetc(NMEA);
85
      };
86

  
87
      for(n=0;n<(19);n++)
88
      {
89
         c=fgetc(NMEA);
90
         if(c=='*')
91
         {
92
            tab4[n]=0;
93
            tab5[0]=c;
94
            tab5[1]=fgetc(NMEA);
95
            tab5[2]=fgetc(NMEA);
96
            tab5[3]=0;
97
            goto tisk;
98
         };
99
         tab4[n]=c;
100
      };
101

  
102
     for(n=0;n<(19);n++)    // Read line up to checksum
103
      {
104
         c=fgetc(NMEA);
105
         if(c=='*')
106
         {
107
            tab5[n]=c;
108
            tab5[n+1]=fgetc(NMEA);
109
            tab5[n+2]=fgetc(NMEA);
110
            tab5[n+3]=0;
111
            break;
112
         };
113
         tab5[n]=c;
114
      };
115

  
116
tisk:
117

  
118
   printf(lcd_putc,"\f");
119

  
120
if(!input(TL1))
121
{
122
    lcd_gotoxy(1,1);
123
      printf(lcd_putc,"%s\n",tab1);
124
      printf(lcd_putc,"%s",tab2);
125
}
126
else
127
{
128
    lcd_gotoxy(1,1);
129
    printf(lcd_putc,"%s\n",tab3);
130
    printf(lcd_putc,"%s",tab4);
131
}
132

  
133
puts(strcat(tab1,strcat(tab2,tab3)),PC);
134
puts(strcat(tab4,tab5),PC);
135
printf(" /%u/%Lu\n\r",input(RANGE), intensity);
136

  
137
   }
138
}
139

  
Designs/GPSRL01B/SW/MYLCD.C
1
// LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
2
// (c)miho 2002
3
//
4
// Historie:
5
//
6
// 0.0   Uvodni verze se snadnou definici portu LCD displeje
7
//
8
//
9
// Funkce:
10
//
11
//   lcd_init()            inicializuje LCD displej a porty, nutno volat jako prvni
12
//
13
//   lcd_putc(c)           zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky
14
//                         \f = \x0C   - nova stranka - smazani displeje
15
//                         \n = \x0A   - odradkovani (prechod na druhou radku)
16
//                         \b = \x08   - backspace - posunuti kurzoru o 1 pozici zpet
17
//                         \r = \x0D   - goto home to position 1,1
18
//                         \0  .. \7   - definovatelne znaky v pozicich 0 az 7 v CGRAM
19
//                         \20 .. \27  - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM
20
//                         Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce)
21
//
22
//   lcd_gotoxy(x,y)       presune kurzor na uvedenou adresu
23
//                         nekontroluje parametry
24
//
25
//   lcd_cursor_on         zapne kurzor
26
//   lcd_cursor_off        vypne kurzor
27
//
28
//   lcd_define_char(Index, Def)       Makro, ktere definuje znaky od pozice Index obsahem definicniho
29
//                                     retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM.
30
//                                     Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7.
31
//                                     Na konci se provede lcd_gotoxy(1,1).
32
//                                     Na konci teto knihovny je priklad pouziti definovanych znaku
33
//
34
// Definice portu:
35
//
36
// #DEFINE LCD_RS          PIN_B2      // rizeni registru LCD displeje
37
// #DEFINE LCD_E           PIN_B1      // enable LCD displeje
38
// #DEFINE LCD_DATA_LSB    PIN_C2      // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
39

  
40

  
41

  
42

  
43
// Privatni sekce, cist jen v pripade, ze neco nefunguje
44

  
45

  
46

  
47

  
48
// Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne
49
// bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva
50
// v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu
51
//
52
#DEFINE LCD_SHIFT (LCD_DATA_LSB&7)                 // pocet bitu posuvu dataoveho kanalu v datovem portu
53
#DEFINE LCD_PORT  (LCD_DATA_LSB>>3)                // adresa LCD datoveho portu
54
#DEFINE LCD_TRIS  (LCD_PORT+0x80)                  // adresa prislusneho TRIS registru
55
#DEFINE LCD_MASK  (0xF<<LCD_SHIFT)                 // maska platnych bitu
56
//
57
#IF LCD_SHIFT>4                                    // kontrola mezi
58
#ERROR LCD data port LSB bit not in range 0..4
59
#ENDIF
60

  
61

  
62
// Definice konstant pro LCD display
63
//
64
#define LCD_CURSOR_ON_  0x0E     // kurzor jako blikajici radka pod znakem
65
#define LCD_CURSOR_OFF_ 0x0C     // zadny kurzor
66
#define LCD_LINE_2      0x40     // adresa 1. znaku 2. radky
67

  
68

  
69
// Definice rezimu LCD displeje
70
//
71
BYTE const LCD_INIT_STRING[4] =
72
{
73
   0x28,                         // intrfejs 4 bity, 2 radky, font 5x7
74
   LCD_CURSOR_OFF_,              // display on, kurzor off,
75
   0x01,                         // clear displeje
76
   0x06                          // inkrement pozice kurzoru (posun kurzoru doprava)
77
};
78

  
79

  
80
// Odesle nibble do displeje (posle data a klikne signalem e)
81
//
82
void lcd_send_nibble( BYTE n )
83
{
84
   *LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK);      // nastav datove bity portu a ostatni zachovej
85
   output_bit(LCD_E,1);       // vzestupna hrana
86
   delay_us(100);               // pockej alespon 450ns od e nebo alespon 195ns od dat
87
   output_bit(LCD_E,0);       // sestupna hrana (minimalni perioda e je 1us)
88
}
89

  
90

  
91
// Odesle bajt do registru LCD
92
//
93
// Pokud je Adr=0 .. instrukcni registr
94
// Pokud je Adr=1 .. datovy registr
95
//
96
void lcd_send_byte( BOOLEAN Adr, BYTE n )
97
{
98
   output_bit(LCD_RS,Adr);    // vyber registr
99
   swap(n);
100
   lcd_send_nibble(n);        // posli horni pulku bajtu
101
   swap(n);
102
   lcd_send_nibble(n);        // posli spodni pulku bajtu
103
   delay_us(200);              // minimalni doba na provedeni prikazu
104
}
105

  
106

  
107
// Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje
108
//
109
// Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur
110
//
111
void lcd_init()
112
{
113

  
114
   int i;                              // pocitadlo cyklu
115

  
116
   delay_ms(20);                       // spozdeni pro provedeni startu displeje po zapnuti napajeni
117

  
118
   *LCD_TRIS = *LCD_TRIS & ~LCD_MASK;  // nuluj odpovidajici bity tris registru datoveho portu LCD
119

  
120
   output_bit(LCD_RS,0);               // nastav jako vystup a nastav klidovy stav
121
   output_bit(LCD_E,0);               // nastav jako vystup a nastav klidovy stav
122

  
123
   for (i=0; i<3; i++)                 // nastav lcd do rezimu 8 bitu sbernice
124
   {
125
      delay_ms(2);                     // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
126
      lcd_send_nibble(3);              // rezim 8 bitu
127
   }
128

  
129
   delay_us(40);                       // cas na zpracovani
130
   lcd_send_nibble(2);                 // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
131
   delay_us(40);                       // cas na zpracovani
132

  
133
   for (i=0;i<3;i++)                   // proved inicializaci (nastaveni modu, smazani apod)
134
   {
135
      lcd_send_byte(0,LCD_INIT_STRING[i]);
136
      delay_ms(2);
137
   }
138
}
139

  
140

  
141
// Proved presun kurzoru
142
//
143
// Pozice 1.1 je domu
144
//
145
#separate
146
void lcd_gotoxy( BYTE x, BYTE y)
147
{
148

  
149
   BYTE Adr;
150

  
151
   switch(y)
152
   {
153
      case 1: Adr=0; break;
154
      case 2: Adr=0x40; break;
155
      case 3: Adr=0x14; break;
156
      case 4: Adr=0x54; break;
157
   }
158
   Adr+=x-1;
159

  
160
   lcd_send_byte(0,0x80|Adr);
161
}
162

  
163

  
164
// Zapis znaku na displej, zpracovani ridicich znaku
165
//
166
#separate
167
void lcd_putc( char c)
168
{
169

  
170
   switch (c)
171
   {
172
      case '\f'   : lcd_send_byte(0,1);            // smaz displej
173
                    delay_ms(2);
174
                                            break;
175
      case '\n'   : lcd_gotoxy(1,2);        break; // presun se na 1. znak 2. radky
176
      case '\r'   : lcd_gotoxy(1,1);        break; // presun home
177
      case '\b'   : lcd_send_byte(0,0x10);  break; // posun kurzor o 1 zpet
178
      default     : if (c<0x20) c&=0x7;            // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
179
                    lcd_send_byte(1,c);     break; // zapis znak
180
   }
181
}
182

  
183

  
184
// Zapni kurzor
185
//
186
void lcd_cursor_on()
187
{
188
   lcd_send_byte(0,LCD_CURSOR_ON_);
189
}
190

  
191

  
192
// Vypni kurzor
193
//
194
void lcd_cursor_off()
195
{
196
   lcd_send_byte(0,LCD_CURSOR_OFF_);
197
}
198

  
199

  
200
// Definice vlastnich fontu
201
//
202
// Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje
203
// Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden
204
// priklad pouziti definovanych znaku.
205

  
206

  
207
// Pomocna procedura pro posilani ridicich dat do radice displeje
208
//
209
void lcd_putc2(int Data)
210
{
211
   lcd_send_byte(1,Data);
212
}
213

  
214

  
215
// Pomocne definice pro programovani obsahu CGRAM
216
//
217
#DEFINE lcd_define_start(Code)      lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2)
218
#DEFINE lcd_define_def(String)      printf(lcd_putc2,String);
219
#DEFINE lcd_define_end()            lcd_send_byte(0,3); delay_ms(2)
220

  
221

  
222
// Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def
223
//
224
#DEFINE lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end();
225

  
226

  
227
// Pripravene definice fontu vybranych znaku
228
// V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80
229
//
230
#DEFINE LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F"      /* symbol plne baterie       */
231
#DEFINE LCD_CHAR_BAT50  "\x0E\x1F\x11\x11\x13\x17\x1F\x1F"      /* symbol polovicni baterie  */
232
#DEFINE LCD_CHAR_BAT0   "\x0E\x1F\x11\x11\x11\x11\x11\x1F"      /* symbol vybite baterie     */
233
#DEFINE LCD_CHAR_LUA    "\x04\x0E\x11\x11\x1F\x11\x11\x80"      /* A s carkou                */
234
#DEFINE LCD_CHAR_LLA    "\x01\x02\x0E\x01\x1F\x11\x0F\x80"      /* a s carkou                */
235
#DEFINE LCD_CHAR_HUC    "\x0A\x0E\x11\x10\x10\x11\x0E\x80"      /* C s hackem                */
236
#DEFINE LCD_CHAR_HLC    "\x0A\x04\x0E\x10\x10\x11\x0E\x80"      /* c s hackem                */
237
#DEFINE LCD_CHAR_HUD    "\x0A\x1C\x12\x11\x11\x12\x1C\x80"      /* D s hackem                */
238
#DEFINE LCD_CHAR_HLD    "\x05\x03\x0D\x13\x11\x11\x0F\x80"      /* d s hackem                */
239
#DEFINE LCD_CHAR_LUE    "\x04\x1F\x10\x10\x1E\x10\x1F\x80"      /* E s carkou                */
240
#DEFINE LCD_CHAR_LLE    "\x01\x02\x0E\x11\x1F\x10\x0E\x80"      /* e s carkou                */
241
#DEFINE LCD_CHAR_HUE    "\x0A\x1F\x10\x1E\x10\x10\x1F\x80"      /* E s hackem                */
242
#DEFINE LCD_CHAR_HLE    "\x0A\x04\x0E\x11\x1F\x10\x0E\x80"      /* e s hackem                */
243
#DEFINE LCD_CHAR_LUI    "\x04\x0E\x04\x04\x04\x04\x0E\x80"      /* I s carkou                */
244
#DEFINE LCD_CHAR_LLI    "\x02\x04\x80\x0C\x04\x04\x0E\x80"      /* i s carkou                */
245
#DEFINE LCD_CHAR_HUN    "\x0A\x15\x11\x19\x15\x13\x11\x80"      /* N s hackem                */
246
#DEFINE LCD_CHAR_HLN    "\x0A\x04\x16\x19\x11\x11\x11\x80"      /* n s hackem                */
247
#DEFINE LCD_CHAR_LUO    "\x04\x0E\x11\x11\x11\x11\x0E\x80"      /* O s carkou                */
248
#DEFINE LCD_CHAR_LLO    "\x02\x04\x0E\x11\x11\x11\x0E\x80"      /* o s carkou                */
249
#DEFINE LCD_CHAR_HUR    "\x0A\x1E\x11\x1E\x14\x12\x11\x80"      /* R s hackem                */
250
#DEFINE LCD_CHAR_HLR    "\x0A\x04\x16\x19\x10\x10\x10\x80"      /* r s hackem                */
251
#DEFINE LCD_CHAR_HUS    "\x0A\x0F\x10\x0E\x01\x01\x1E\x80"      /* S s hackem                */
252
#DEFINE LCD_CHAR_HLS    "\x0A\x04\x0E\x10\x0E\x01\x1E\x80"      /* s s hackem                */
253
#DEFINE LCD_CHAR_HUT    "\x0A\x1F\x04\x04\x04\x04\x04\x80"      /* T s hackem                */
254
#DEFINE LCD_CHAR_HLT    "\x0A\x0C\x1C\x08\x08\x09\x06\x80"      /* t s hackem                */
255
#DEFINE LCD_CHAR_LUU    "\x02\x15\x11\x11\x11\x11\x0E\x80"      /* U s carkou                */
256
#DEFINE LCD_CHAR_LLU    "\x02\x04\x11\x11\x11\x13\x0D\x80"      /* u s carkou                */
257
#DEFINE LCD_CHAR_CUU    "\x06\x17\x11\x11\x11\x11\x0E\x80"      /* U s krouzkem              */
258
#DEFINE LCD_CHAR_CLU    "\x06\x06\x11\x11\x11\x11\x0E\x80"      /* u s krouzkem              */
259
#DEFINE LCD_CHAR_LUY    "\x02\x15\x11\x0A\x04\x04\x04\x80"      /* Y s carkou                */
260
#DEFINE LCD_CHAR_LLY    "\x02\x04\x11\x11\x0F\x01\x0E\x80"      /* y s carkou                */
261
#DEFINE LCD_CHAR_HUZ    "\x0A\x1F\x01\x02\x04\x08\x1F\x80"      /* Z s hackem                */
262
#DEFINE LCD_CHAR_HLZ    "\x0A\x04\x1F\x02\x04\x08\x1F\x80"      /* z s hackem                */
263

  
264

  
265
// Priklad pouziti definovanych znaku
266
//
267
//
268
//void lcd_sample()
269
//{
270
//   lcd_define_char(0,LCD_CHAR_BAT50);                 // Priklad definice znaku baterie do pozice 0
271
//   lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI);      // Priklad definice znaku e s hackem a I s carkou od pozice 2
272
//                                                      // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji
273
//                                                      // jediny definicni retezec)
274
//   printf(lcd_putc,"\fZnaky:\20\22\23");              // priklad vypisu znaku z pozice 0, 2 a 3
275
//   delay_ms(1000);
276
//   lcd_define_char(0,LCD_CHAR_BAT0);                  // Predefinovani tvaru znaku v pozici 0
277
//   delay_ms(1000);
278
//}
Designs/GPSRL03A/ff.h
1
/*--------------------------------------------------------------------------/
2
/  FatFs - FAT file system module include file  R0.06        (C)ChaN, 2008
3
/---------------------------------------------------------------------------/
4
/ FatFs module is an experimenal project to implement FAT file system to
5
/ cheap microcontrollers. This is a free software and is opened for education,
6
/ research and development under license policy of following trems.
7
/
8
/  Copyright (C) 2008, ChaN, all right reserved.
9
/
10
/ * The FatFs module is a free software and there is no warranty.
11
/ * You can use, modify and/or redistribute it for personal, non-profit or
12
/   commercial use without any restriction under your responsibility.
13
/ * Redistributions of source code must retain the above copyright notice.
14
/
15
/---------------------------------------------------------------------------*/
16

  
17
#ifndef _FATFS
18

  
19
#define _MCU_ENDIAN		0
20
/* The _MCU_ENDIAN defines which access method is used to the FAT structure.
21
/  1: Enable word access.
22
/  2: Disable word access and use byte-by-byte access instead.
23
/  When the architectural byte order of the MCU is big-endian and/or address
24
/  miss-aligned access results incorrect behavior, the _MCU_ENDIAN must be set to 2.
25
/  If it is not the case, it can also be set to 1 for good code efficiency. */
26

  
27
#define _FS_READONLY	0
28
/* Setting _FS_READONLY to 1 defines read only configuration. This removes
29
/  writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
30
/  f_truncate and useless f_getfree. */
31

  
32
#define _FS_MINIMIZE	0
33
/* The _FS_MINIMIZE option defines minimization level to remove some functions.
34
/  0: Full function.
35
/  1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename are removed.
36
/  2: f_opendir and f_readdir are removed in addition to level 1.
37
/  3: f_lseek is removed in addition to level 2. */
38

  
39
#define	_USE_STRFUNC	0
40
/* To enable string functions, set _USE_STRFUNC to 1 or 2. */
41

  
42
#define	_USE_MKFS	0
43
/* When _USE_MKFS is set to 1 and _FS_READONLY is set to 0, f_mkfs function is
44
/  enabled. */
45

  
46
#define _DRIVES		2
47
/* Number of logical drives to be used. This affects the size of internal table. */
48

  
49
#define	_MULTI_PARTITION	0
50
/* When _MULTI_PARTITION is set to 0, each logical drive is bound to same
51
/  physical drive number and can mount only 1st primaly partition. When it is
52
/  set to 1, each logical drive can mount a partition listed in Drives[]. */
53

  
54
#define _USE_FSINFO	0
55
/* To enable FSInfo support on FAT32 volume, set _USE_FSINFO to 1. */
56

  
57
#define	_USE_SJIS	1
58
/* When _USE_SJIS is set to 1, Shift-JIS code transparency is enabled, otherwise
59
/  only US-ASCII(7bit) code can be accepted as file/directory name. */
60

  
61
#define	_USE_NTFLAG	1
62
/* When _USE_NTFLAG is set to 1, upper/lower case of the file name is preserved.
63
/  Note that the files are always accessed in case insensitive. */
64

  
65

  
66
#include "integer.h"
67

  
68

  
69

  
70
/* Definitions corresponds to multiple sector size (not tested) */
71
#define	S_MAX_SIZ	512U			/* Do not change */
72
#if S_MAX_SIZ > 512U
73
#define	SS(fs)	((fs)->s_size)
74
#else
75
#define	SS(fs)	512U
76
#endif
77

  
78

  
79
/* File system object structure */
80
typedef struct _FATFS {
81
	WORD	id;				/* File system mount ID */
82
	WORD	n_rootdir;		/* Number of root directory entries */
83
	DWORD	winsect;		/* Current sector appearing in the win[] */
84
	DWORD	sects_fat;		/* Sectors per fat */
85
	DWORD	max_clust;		/* Maximum cluster# + 1 */
86
	DWORD	fatbase;		/* FAT start sector */
87
	DWORD	dirbase;		/* Root directory start sector (cluster# for FAT32) */
88
	DWORD	database;		/* Data start sector */
89
#if !_FS_READONLY
90
	DWORD	last_clust;		/* Last allocated cluster */
91
	DWORD	free_clust;		/* Number of free clusters */
92
#if _USE_FSINFO
93
	DWORD	fsi_sector;		/* fsinfo sector */
94
	BYTE	fsi_flag;		/* fsinfo dirty flag (1:must be written back) */
95
	BYTE	pad2;
96
#endif
97
#endif
98
	BYTE	fs_type;		/* FAT sub type */
99
	BYTE	csize;			/* Number of sectors per cluster */
100
#if S_MAX_SIZ > 512U
101
	WORD	s_size;			/* Sector size */
102
#endif
103
	BYTE	n_fats;			/* Number of FAT copies */
104
	BYTE	drive;			/* Physical drive number */
105
	BYTE	winflag;		/* win[] dirty flag (1:must be written back) */
106
	BYTE	pad1;
107
	BYTE	win[S_MAX_SIZ];	/* Disk access window for Directory/FAT */
108
} FATFS;
109

  
110

  
111
/* Directory object structure */
112
typedef struct _DIR {
113
	WORD	id;			/* Owner file system mount ID */
114
	WORD	index;		/* Current index */
115
	FATFS*	fs;			/* Pointer to the owner file system object */
116
	DWORD	sclust;		/* Start cluster */
117
	DWORD	clust;		/* Current cluster */
118
	DWORD	sect;		/* Current sector */
119
} DIR;
120

  
121

  
122
/* File object structure */
123
typedef struct _FIL {
124
	WORD	id;				/* Owner file system mount ID */
125
	BYTE	flag;			/* File status flags */
126
	BYTE	csect;			/* Sector address in the cluster */
127
	FATFS*	fs;				/* Pointer to the owner file system object */
128
	DWORD	fptr;			/* File R/W pointer */
129
	DWORD	fsize;			/* File size */
130
	DWORD	org_clust;		/* File start cluster */
131
	DWORD	curr_clust;		/* Current cluster */
132
	DWORD	curr_sect;		/* Current sector */
133
#if _FS_READONLY == 0
134
	DWORD	dir_sect;		/* Sector containing the directory entry */
135
	BYTE*	dir_ptr;		/* Ponter to the directory entry in the window */
136
#endif
137
	BYTE	buffer[S_MAX_SIZ];	/* File R/W buffer */
138
} FIL;
139

  
140

  
141
/* File status structure */
142
typedef struct _FILINFO {
143
	DWORD fsize;			/* Size */
144
	WORD fdate;				/* Date */
145
	WORD ftime;				/* Time */
146
	BYTE fattrib;			/* Attribute */
147
	char fname[8+1+3+1];	/* Name (8.3 format) */
148
} FILINFO;
149

  
150

  
151

  
152
/* Definitions corresponds to multi partition */
153

  
154
#if _MULTI_PARTITION != 0	/* Multiple partition cfg */
155

  
156
typedef struct _PARTITION {
157
	BYTE pd;	/* Physical drive # (0-255) */
158
	BYTE pt;	/* Partition # (0-3) */
159
} PARTITION;
160
extern
161
const PARTITION Drives[];			/* Logical drive# to physical location conversion table */
162
#define LD2PD(drv) (Drives[drv].pd)	/* Get physical drive# */
163
#define LD2PT(drv) (Drives[drv].pt)	/* Get partition# */
164

  
165
#else						/* Single partition cfg */
166

  
167
#define LD2PD(drv) (drv)		/* Physical drive# is equal to logical drive# */
168
#define LD2PT(drv) 0			/* Always mounts the 1st partition */
169

  
170
#endif
171

  
172

  
173
/* File function return code (FRESULT) */
174

  
175
typedef enum {
176
	FR_OK = 0,			/* 0 */
177
	FR_NOT_READY,		/* 1 */
178
	FR_NO_FILE,			/* 2 */
179
	FR_NO_PATH,			/* 3 */
180
	FR_INVALID_NAME,	/* 4 */
181
	FR_INVALID_DRIVE,	/* 5 */
182
	FR_DENIED,			/* 6 */
183
	FR_EXIST,			/* 7 */
184
	FR_RW_ERROR,		/* 8 */
185
	FR_WRITE_PROTECTED,	/* 9 */
186
	FR_NOT_ENABLED,		/* 10 */
187
	FR_NO_FILESYSTEM,	/* 11 */
188
	FR_INVALID_OBJECT,	/* 12 */
189
	FR_MKFS_ABORTED		/* 13 */
190
} FRESULT;
191

  
192

  
193

  
194
/*-----------------------------------------------------*/
195
/* FatFs module application interface                  */
196

  
197
FRESULT f_mount (BYTE, FATFS*);						/* Mount/Unmount a logical drive */
198
FRESULT f_open (FIL*, const char*, BYTE);			/* Open or create a file */
199
FRESULT f_read (FIL*, void*, UINT, UINT*);			/* Read data from a file */
200
FRESULT f_write (FIL*, const void*, UINT, UINT*);	/* Write data to a file */
201
FRESULT f_lseek (FIL*, DWORD);						/* Move file pointer of a file object */
202
FRESULT f_close (FIL*);								/* Close an open file object */
203
FRESULT f_opendir (DIR*, const char*);				/* Open an existing directory */
204
FRESULT f_readdir (DIR*, FILINFO*);					/* Read a directory item */
205
FRESULT f_stat (const char*, FILINFO*);				/* Get file status */
206
FRESULT f_getfree (const char*, DWORD*, FATFS**);	/* Get number of free clusters on the drive */
207
FRESULT f_truncate (FIL*);							/* Truncate file */
208
FRESULT f_sync (FIL*);								/* Flush cached data of a writing file */
209
FRESULT f_unlink (const char*);						/* Delete an existing file or directory */
210
FRESULT	f_mkdir (const char*);						/* Create a new directory */
211
FRESULT f_chmod (const char*, BYTE, BYTE);			/* Change file/dir attriburte */
212
FRESULT f_utime (const char*, const FILINFO*);		/* Change file/dir timestamp */
213
FRESULT f_rename (const char*, const char*);		/* Rename/Move a file or directory */
214
FRESULT f_mkfs (BYTE, BYTE, WORD);					/* Create a file system on the drive */
215
#if _USE_STRFUNC
216
#define feof(fp) ((fp)->fptr == (fp)->fsize)
217
#define EOF -1
218
int fputc (int, FIL*);								/* Put a character to the file */
219
int fputs (const char*, FIL*);						/* Put a string to the file */
220
int fprintf (FIL*, const char*, ...);				/* Put a formatted string to the file */
221
char* fgets (char*, int, FIL*);						/* Get a string from the file */
222
#endif
223

  
224
/* User defined function to give a current time to fatfs module */
225

  
226
DWORD get_fattime (void);	/* 31-25: Year(0-127 org.1980), 24-21: Month(1-12), 20-16: Day(1-31) */
227
							/* 15-11: Hour(0-23), 10-5: Minute(0-59), 4-0: Second(0-29 *2) */
228

  
229

  
230

  
231
/* File access control and file status flags (FIL.flag) */
232

  
233
#define	FA_READ				0x01
234
#define	FA_OPEN_EXISTING	0x00
235
#if _FS_READONLY == 0
236
#define	FA_WRITE			0x02
237
#define	FA_CREATE_NEW		0x04
238
#define	FA_CREATE_ALWAYS	0x08
239
#define	FA_OPEN_ALWAYS		0x10
240
#define FA__WRITTEN			0x20
241
#define FA__DIRTY			0x40
242
#endif
243
#define FA__ERROR			0x80
244

  
245

  
246
/* FAT sub type (FATFS.fs_type) */
247

  
248
#define FS_FAT12	1
249
#define FS_FAT16	2
250
#define FS_FAT32	3
251

  
252

  
253
/* File attribute bits for directory entry */
254

  
255
#define	AM_RDO	0x01	/* Read only */
256
#define	AM_HID	0x02	/* Hidden */
257
#define	AM_SYS	0x04	/* System */
258
#define	AM_VOL	0x08	/* Volume label */
259
#define AM_LFN	0x0F	/* LFN entry */
260
#define AM_DIR	0x10	/* Directory */
261
#define AM_ARC	0x20	/* Archive */
262

  
263

  
264

  
265
/* Offset of FAT structure members */
266

  
267
#define BS_jmpBoot			0
268
#define BS_OEMName			3
269
#define BPB_BytsPerSec		11
270
#define BPB_SecPerClus		13
271
#define BPB_RsvdSecCnt		14
272
#define BPB_NumFATs			16
273
#define BPB_RootEntCnt		17
274
#define BPB_TotSec16		19
275
#define BPB_Media			21
276
#define BPB_FATSz16			22
277
#define BPB_SecPerTrk		24
278
#define BPB_NumHeads		26
279
#define BPB_HiddSec			28
280
#define BPB_TotSec32		32
281
#define BS_55AA				510
282

  
283
#define BS_DrvNum			36
284
#define BS_BootSig			38
285
#define BS_VolID			39
286
#define BS_VolLab			43
287
#define BS_FilSysType		54
288

  
289
#define BPB_FATSz32			36
290
#define BPB_ExtFlags		40
291
#define BPB_FSVer			42
292
#define BPB_RootClus		44
293
#define BPB_FSInfo			48
294
#define BPB_BkBootSec		50
295
#define BS_DrvNum32			64
296
#define BS_BootSig32		66
297
#define BS_VolID32			67
298
#define BS_VolLab32			71
299
#define BS_FilSysType32		82
300

  
301
#define	FSI_LeadSig			0
302
#define	FSI_StrucSig		484
303
#define	FSI_Free_Count		488
304
#define	FSI_Nxt_Free		492
305

  
306
#define MBR_Table			446
307

  
308
#define	DIR_Name			0
309
#define	DIR_Attr			11
310
#define	DIR_NTres			12
311
#define	DIR_CrtTime			14
312
#define	DIR_CrtDate			16
313
#define	DIR_FstClusHI		20
314
#define	DIR_WrtTime			22
315
#define	DIR_WrtDate			24
316
#define	DIR_FstClusLO		26
317
#define	DIR_FileSize		28
318

  
319

  
320

  
321
/* Multi-byte word access macros  */
322

  
323
#if _MCU_ENDIAN == 1	/* Use word access */
324
#define	LD_WORD(ptr)		(WORD)(*(WORD*)(BYTE*)(ptr))
325
#define	LD_DWORD(ptr)		(DWORD)(*(DWORD*)(BYTE*)(ptr))
326
#define	ST_WORD(ptr,val)	*(WORD*)(BYTE*)(ptr)=(WORD)(val)
327
#define	ST_DWORD(ptr,val)	*(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
328
#elif _MCU_ENDIAN == 2	/* Use byte-by-byte access */
329
#define	LD_WORD(ptr)		(WORD)(((WORD)*(volatile BYTE*)((ptr)+1)<<8)|(WORD)*(volatile BYTE*)(ptr))
330
#define	LD_DWORD(ptr)		(DWORD)(((DWORD)*(volatile BYTE*)((ptr)+3)<<24)|((DWORD)*(volatile BYTE*)((ptr)+2)<<16)|((WORD)*(volatile BYTE*)((ptr)+1)<<8)|*(volatile BYTE*)(ptr))
331
#define	ST_WORD(ptr,val)	*(volatile BYTE*)(ptr)=(BYTE)(val); *(volatile BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
332
#define	ST_DWORD(ptr,val)	*(volatile BYTE*)(ptr)=(BYTE)(val); *(volatile BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8); *(volatile BYTE*)((ptr)+2)=(BYTE)((DWORD)(val)>>16); *(volatile BYTE*)((ptr)+3)=(BYTE)((DWORD)(val)>>24)
333
#else
334
#error Do not forget to set _MCU_ENDIAN properly!
335
#endif
336

  
337

  
338
#define _FATFS
339
#endif /* _FATFS */
Designs/GPSRL03A/integer.h
1
#ifndef _INTEGER
2

  
3
typedef int				INT;
4
typedef unsigned int	UINT;
5

  
6
typedef char			CHAR;
7
typedef unsigned char	UCHAR;
8
typedef unsigned char	BYTE;
9

  
10
typedef short			SHORT;
11
typedef unsigned short	USHORT;
12
typedef unsigned short	WORD;
13

  
14
typedef long			LONG;
15
typedef unsigned long	ULONG;
16
typedef unsigned long	DWORD;
17

  
18
typedef unsigned char	BOOL;
19
#define FALSE	0
20
#define TRUE	1
21

  
22
#define _INTEGER
23
#endif
Designs/GPSRL03A/tt.ini
1
bps=115200
Designs/GPSRL03A/tff.h
1
/*--------------------------------------------------------------------------/
2
/  Tiny-FatFs - FAT file system module include file  R0.04b   (C)ChaN, 2007
3
/---------------------------------------------------------------------------/
4
/ FatFs module is an experimenal project to implement FAT file system to
5
/ cheap microcontrollers. This is a free software and is opened for education,
6
/ research and development under license policy of following trems.
7
/
8
/  Copyright (C) 2007, ChaN, all right reserved.
9
/
10
/ * The FatFs module is a free software and there is no warranty.
11
/ * You can use, modify and/or redistribute it for personal, non-profit or
12
/   profit use without any restriction under your responsibility.
13
/ * Redistributions of source code must retain the above copyright notice.
14
/
15
/---------------------------------------------------------------------------*/
16

  
17
#ifndef _FATFS
18

  
19
#define _MCU_ENDIAN		1
20
/* The _MCU_ENDIAN defines which access method is used to the FAT structure.
21
/  1: Enable word access.
22
/  2: Disable word access and use byte-by-byte access instead.
23
/  When the architectural byte order of the MCU is big-endian and/or address
24
/  miss-aligned access is prohibited, the _MCU_ENDIAN must be set to 2.
25
/  If it is not the case, it can be set to 1 for good code efficiency. */
26

  
27
#define _FS_READONLY	0
28
/* Setting _FS_READONLY to 1 defines read only configuration. This removes
29
/  writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename
30
/  and useless f_getfree. */
31

  
32
#define _FS_MINIMIZE	2
33
/* The _FS_MINIMIZE option defines minimization level to remove some functions.
34
/  0: Full function.
35
/  1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod and f_rename are removed.
36
/  2: f_opendir and f_readdir are removed in addition to level 1.
37
/  3: f_lseek is removed in addition to level 2. */
38

  
39
#define _FAT32	0
40
/* To support FAT32 in addition of FAT12/16, set _FAT32 to 1. */
41

  
42
#define _USE_FSINFO	0
43
/* To support FSInfo on FAT32 volume, set _USE_FSINFO to 1. */
44

  
45
#define	_USE_SJIS	0
46
/* When _USE_SJIS is set to 1, Shift-JIS code transparency is enabled, otherwise
47
/  only US-ASCII(7bit) code can be accepted as file/directory name. */
48

  
49
#define	_USE_NTFLAG	1
50
/* When _USE_NTFLAG is set to 1, upper/lower case of the file name is preserved. */
51

  
52

  
53
#include "integer.h"
54

  
55

  
56
/* Type definition for cluster number */
57
#if _FAT32
58
typedef DWORD	CLUST;
59
#else
60
typedef WORD	CLUST;
61
#undef _USE_FSINFO
62
#define _USE_FSINFO	0
63
#endif
64

  
65

  
66
/* File system object structure */
67
typedef struct _FATFS {
68
	WORD	id;				/* File system mount ID */
69
	WORD	n_rootdir;		/* Number of root directory entries */
70
	DWORD	winsect;		/* Current sector appearing in the win[] */
71
	DWORD	fatbase;		/* FAT start sector */
72
	DWORD	dirbase;		/* Root directory start sector */
73
	DWORD	database;		/* Data start sector */
74
	CLUST	sects_fat;		/* Sectors per fat */
75
	CLUST	max_clust;		/* Maximum cluster# + 1 */
76
#if !_FS_READONLY
77
	CLUST	last_clust;		/* Last allocated cluster */
78
	CLUST	free_clust;		/* Number of free clusters */
79
#if _USE_FSINFO
80
	DWORD	fsi_sector;		/* fsinfo sector */
81
	BYTE	fsi_flag;		/* fsinfo dirty flag (1:must be written back) */
82
	BYTE	pad1;
83
#endif
84
#endif
85
	BYTE	fs_type;		/* FAT sub type */
86
	BYTE	sects_clust;	/* Sectors per cluster */
87
	BYTE	n_fats;			/* Number of FAT copies */
88
	BYTE	winflag;		/* win[] dirty flag (1:must be written back) */
89
	BYTE	win[512];		/* Disk access window for Directory/FAT/File */
90
} FATFS;
91

  
92

  
93
/* Directory object structure */
94
typedef struct _DIR {
95
	WORD	id;			/* Owner file system mount ID */
96
	WORD	index;		/* Current index */
97
	FATFS*	fs;			/* Pointer to the owner file system object */
98
	CLUST	sclust;		/* Start cluster */
99
	CLUST	clust;		/* Current cluster */
100
	DWORD	sect;		/* Current sector */
101
} DIR;
102

  
103

  
104
/* File object structure */
105
typedef struct _FIL {
106
	WORD	id;				/* Owner file system mount ID */
107
	BYTE	flag;			/* File status flags */
108
	BYTE	sect_clust;		/* Left sectors in cluster */
109
	FATFS*	fs;				/* Pointer to owner file system */
110
	DWORD	fptr;			/* File R/W pointer */
111
	DWORD	fsize;			/* File size */
112
	CLUST	org_clust;		/* File start cluster */
113
	CLUST	curr_clust;		/* Current cluster */
114
	DWORD	curr_sect;		/* Current sector */
115
#if !_FS_READONLY
116
	DWORD	dir_sect;		/* Sector containing the directory entry */
117
	BYTE*	dir_ptr;		/* Ponter to the directory entry in the window */
118
#endif
119
} FIL;
120

  
121

  
122
/* File status structure */
123
typedef struct _FILINFO {
124
	DWORD fsize;			/* Size */
125
	WORD fdate;				/* Date */
126
	WORD ftime;				/* Time */
127
	BYTE fattrib;			/* Attribute */
128
	char fname[8+1+3+1];	/* Name (8.3 format) */
129
} FILINFO;
130

  
131

  
132
/* File function return code (FRESULT) */
133

  
134
typedef enum {
135
	FR_OK = 0,			/* 0 */
136
	FR_NOT_READY,		/* 1 */
137
	FR_NO_FILE,			/* 2 */
138
	FR_NO_PATH,			/* 3 */
139
	FR_INVALID_NAME,	/* 4 */
140
	FR_INVALID_DRIVE,	/* 5 */
141
	FR_DENIED,			/* 6 */
142
	FR_EXIST,			/* 7 */
143
	FR_RW_ERROR,		/* 8 */
144
	FR_WRITE_PROTECTED,	/* 9 */
145
	FR_NOT_ENABLED,		/* 10 */
146
	FR_NO_FILESYSTEM,	/* 11 */
147
	FR_INVALID_OBJECT	/* 12 */
148
} FRESULT;
149

  
150

  
151

  
152
/*-----------------------------------------------------*/
153
/* FatFs module application interface                  */
154

  
155
FRESULT f_mount (BYTE, FATFS*);						/* Mount/Unmount a logical drive */
156
FRESULT f_open (FIL*, const char*, BYTE);			/* Open or create a file */
157
FRESULT f_read (FIL*, void*, WORD, WORD*);			/* Read data from a file */
158
FRESULT f_write (FIL*, const void*, WORD, WORD*);	/* Write data to a file */
159
FRESULT f_lseek (FIL*, DWORD);						/* Move file pointer of a file object */
160
FRESULT f_close (FIL*);								/* Close an open file object */
161
FRESULT f_opendir (DIR*, const char*);				/* Open an existing directory */
162
FRESULT f_readdir (DIR*, FILINFO*);					/* Read a directory item */
163
FRESULT f_stat (const char*, FILINFO*);				/* Get file status */
164
FRESULT f_getfree (const char*, DWORD*, FATFS**);	/* Get number of free clusters on the drive */
165
FRESULT f_sync (FIL*);								/* Flush cached data of a writing file */
166
FRESULT f_unlink (const char*);						/* Delete an existing file or directory */
167
FRESULT	f_mkdir (const char*);						/* Create a new directory */
168
FRESULT f_chmod (const char*, BYTE, BYTE);			/* Change file/dir attriburte */
169
FRESULT f_rename (const char*, const char*);		/* Rename/Move a file or directory */
170

  
171

  
172
/* User defined function to give a current time to fatfs module */
173

  
174
DWORD get_fattime (void);	/* 31-25: Year(0-127 +1980), 24-21: Month(1-12), 20-16: Day(1-31) */
175
							/* 15-11: Hour(0-23), 10-5: Minute(0-59), 4-0: Second(0-29 *2) */
176

  
177

  
178

  
179
/* File access control and file status flags (FIL.flag) */
180

  
181
#define	FA_READ				0x01
182
#define	FA_OPEN_EXISTING	0x00
183
#if !_FS_READONLY
184
#define	FA_WRITE			0x02
185
#define	FA_CREATE_NEW		0x04
186
#define	FA_CREATE_ALWAYS	0x08
187
#define	FA_OPEN_ALWAYS		0x10
188
#define FA__WRITTEN			0x20
189
#endif
190
#define FA__ERROR			0x80
191

  
192

  
193
/* FAT sub type (FATFS.fs_type) */
194

  
195
#define FS_FAT12	1
196
#define FS_FAT16	2
197
#define FS_FAT32	3
198

  
199

  
200
/* File attribute bits for directory entry */
201

  
202
#define	AM_RDO	0x01	/* Read only */
203
#define	AM_HID	0x02	/* Hidden */
204
#define	AM_SYS	0x04	/* System */
205
#define	AM_VOL	0x08	/* Volume label */
206
#define AM_LFN	0x0F	/* LFN entry */
207
#define AM_DIR	0x10	/* Directory */
208
#define AM_ARC	0x20	/* Archive */
209

  
210

  
211

  
212
/* Offset of FAT structure members */
213

  
214
#define BS_jmpBoot			0
215
#define BS_OEMName			3
216
#define BPB_BytsPerSec		11
217
#define BPB_SecPerClus		13
218
#define BPB_RsvdSecCnt		14
219
#define BPB_NumFATs			16
220
#define BPB_RootEntCnt		17
... This diff was truncated because it exceeds the maximum size that can be displayed. :@created_atf1420411498.4397089$1:@expires_in0