This repository was archived by the owner on Jan 10, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlowchart.fprg
More file actions
106 lines (106 loc) · 5.13 KB
/
Copy pathFlowchart.fprg
File metadata and controls
106 lines (106 loc) · 5.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?xml version="1.0"?>
<flowgorithm fileversion="3.0">
<attributes>
<attribute name="name" value=""/>
<attribute name="authors" value="nikoa"/>
<attribute name="about" value=""/>
<attribute name="saved" value="2023-09-15 09:46:53 "/>
<attribute name="created" value="bmlrb2E7Q0hBUklTQVJELVBSTzsyMDIzLTA5LTE0OyIxMTowNTo1OCAiOzI2Njk="/>
<attribute name="edited" value="bmlrb2E7Q0hBUklTQVJELVBSTzsyMDIzLTA5LTE1OyIwOTo0Njo1MyAiOzM7Mjc4Nw=="/>
</attributes>
<function name="Main" type="None" variable="">
<parameters/>
<body>
<declare name="primoSegnaleArrivato, contatoreRicezione, ricezioneCompletata" type="Integer" array="False" size=""/>
<declare name="datiCatturati" type="Integer" array="True" size="32"/>
<assign variable="primoSegnaleArrivato" expression="0"/>
<assign variable="contatoreRicezione" expression="0"/>
<assign variable="ricezioneCompletata" expression="0"/>
<call expression="setup()"/>
<while expression="true">
<comment text="Attendo l'arrivo di un impulso nel pin 8"/>
<if expression=""Arriva l'impulso"">
<then>
<call expression="ISR(vettoreTimer1)"/>
</then>
<else/>
</if>
<call expression="getCommand()"/>
</while>
</body>
</function>
<function name="getCommand" type="None" variable="">
<parameters/>
<body>
<if expression="ricezioneCompletata">
<then>
<declare name="streamRicevuto" type="String" array="False" size=""/>
<for variable="i" start="0" end="32" direction="inc" step="1">
<if expression=""1.0 ms < datiCatturati[i] < 1.2ms"">
<then>
<assign variable="receiveStream" expression=""aggiungo 0 allo stream ricevuto""/>
</then>
<else>
<if expression=""2.1 ms < datiCatturati[i] < 2.4ms"">
<then>
<assign variable="streamRicevuto" expression=""aggiungo 1 allo stream ricevuto""/>
</then>
<else/>
</if>
</else>
</if>
</for>
<output expression=""0xstreamRicevuto convertito in esadecimale"" newline="True"/>
</then>
<else>
<breakpoint expression=""return 0"" always="False"/>
</else>
</if>
</body>
</function>
<function name="ISR" type="None" variable="">
<parameters>
<parameter name="vettoreTimer1" type="String" array="False"/>
</parameters>
<body>
<if expression="primoSegnaleArrivato">
<then>
<assign variable="datiCatturati[contatoreRicezione]" expression="ICR1"/>
<if expression="datiCatturati[contatoreRicezione] > 625">
<then>
<assign variable="contatoreRicezione" expression="0"/>
<assign variable="ricezioneCompletata" expression="0"/>
</then>
<else>
<assign variable="contatoreRicezione" expression="contatoreRicezione+1"/>
<if expression="contatoreRicezione == 32">
<then>
<assign variable="ricezioneCompletata" expression="1"/>
</then>
<else/>
</if>
</else>
</if>
</then>
<else>
<assign variable="primoSegnaleArrivato" expression="1"/>
<comment text="Inizio la lettura dal secondo fronte di salita, ovvero dopo il burst di impulsi anticipato di 9 ms "/>
</else>
</if>
</body>
</function>
<function name="setup" type="None" variable="">
<parameters/>
<body>
<assign variable="pin8" expression="INPUT"/>
<comment text="Il pin 8 è impostato come INPUT"/>
<assign variable="TCCR1A" expression="0"/>
<assign variable="TCCR1B" expression=""prescalare a 64""/>
<assign variable="TCCR1C" expression="0"/>
<comment text="I timer 0 e 2 sono impostati a 0, mentre il timer 1 è impostato con prescalare 64"/>
<assign variable="TIMSK1" expression=""Abilita l'interrupt di cattura dell'input""/>
<call expression="sei()"/>
<comment text="Abilito gli interrupt globali"/>
</body>
</function>
</flowgorithm>