Subversion Repositories svnkaklik

Rev

Rev 10 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 10 Rev 12
1
CCS PCM C Compiler, Version 3.245, 27853               12-IX-06 23:20
1
CCS PCM C Compiler, Version 3.245, 27853               17-IX-06 22:12
2
 
2
 
3
               Filename: D:\KAKL\roboti\solarni\2006\scamnum\menic.lst
3
               Filename: D:\KAKL\roboti\solarni\2006\scamnum\menic.lst
4
 
4
 
5
               ROM used: 837 words (20%)
5
               ROM used: 836 words (20%)
6
                         Largest free fragment is 2048
6
                         Largest free fragment is 2048
7
               RAM used: 85 (49%) at main() level
7
               RAM used: 87 (50%) at main() level
8
                         91 (52%) worst case
8
                         94 (54%) worst case
9
               Stack:    4 worst case (3 in main + 1 for interrupts)
9
               Stack:    4 worst case (3 in main + 1 for interrupts)
10
 
10
 
11
*
11
*
12
0000:  MOVLW  00
12
0000:  MOVLW  00
13
0001:  MOVWF  0A
13
0001:  MOVWF  0A
14
0002:  GOTO   1BA
14
0002:  GOTO   1C3
15
0003:  NOP
15
0003:  NOP
16
0004:  MOVWF  7F
16
0004:  MOVWF  7F
17
0005:  SWAPF  03,W
17
0005:  SWAPF  03,W
18
0006:  CLRF   03
18
0006:  CLRF   03
19
0007:  MOVWF  21
19
0007:  MOVWF  21
20
0008:  MOVF   7F,W
20
0008:  MOVF   7F,W
21
0009:  MOVWF  20
21
0009:  MOVWF  20
22
000A:  MOVF   0A,W
22
000A:  MOVF   0A,W
23
000B:  MOVWF  28
23
000B:  MOVWF  28
24
000C:  CLRF   0A
24
000C:  CLRF   0A
25
000D:  SWAPF  20,F
25
000D:  SWAPF  20,F
26
000E:  MOVF   04,W
26
000E:  MOVF   04,W
27
000F:  MOVWF  22
27
000F:  MOVWF  22
28
0010:  MOVF   77,W
28
0010:  MOVF   77,W
29
0011:  MOVWF  23
29
0011:  MOVWF  23
30
0012:  MOVF   78,W
30
0012:  MOVF   78,W
31
0013:  MOVWF  24
31
0013:  MOVWF  24
32
0014:  MOVF   79,W
32
0014:  MOVF   79,W
33
0015:  MOVWF  25
33
0015:  MOVWF  25
34
0016:  MOVF   7A,W
34
0016:  MOVF   7A,W
35
0017:  MOVWF  26
35
0017:  MOVWF  26
36
0018:  MOVF   7B,W
36
0018:  MOVF   7B,W
37
0019:  MOVWF  27
37
0019:  MOVWF  27
38
001A:  BCF    03.7
38
001A:  BCF    03.7
39
001B:  BCF    03.5
39
001B:  BCF    03.5
40
001C:  MOVLW  8C
40
001C:  MOVLW  8C
41
001D:  MOVWF  04
41
001D:  MOVWF  04
42
001E:  BTFSS  00.3
42
001E:  BTFSS  00.3
43
001F:  GOTO   022
43
001F:  GOTO   022
44
0020:  BTFSC  0C.3
44
0020:  BTFSC  0C.3
45
0021:  GOTO   035
45
0021:  GOTO   035
46
0022:  MOVF   22,W
46
0022:  MOVF   22,W
47
0023:  MOVWF  04
47
0023:  MOVWF  04
48
0024:  MOVF   23,W
48
0024:  MOVF   23,W
49
0025:  MOVWF  77
49
0025:  MOVWF  77
50
0026:  MOVF   24,W
50
0026:  MOVF   24,W
51
0027:  MOVWF  78
51
0027:  MOVWF  78
52
0028:  MOVF   25,W
52
0028:  MOVF   25,W
53
0029:  MOVWF  79
53
0029:  MOVWF  79
54
002A:  MOVF   26,W
54
002A:  MOVF   26,W
55
002B:  MOVWF  7A
55
002B:  MOVWF  7A
56
002C:  MOVF   27,W
56
002C:  MOVF   27,W
57
002D:  MOVWF  7B
57
002D:  MOVWF  7B
58
002E:  MOVF   28,W
58
002E:  MOVF   28,W
59
002F:  MOVWF  0A
59
002F:  MOVWF  0A
60
0030:  SWAPF  21,W
60
0030:  SWAPF  21,W
61
0031:  MOVWF  03
61
0031:  MOVWF  03
62
0032:  SWAPF  7F,F
62
0032:  SWAPF  7F,F
63
0033:  SWAPF  7F,W
63
0033:  SWAPF  7F,W
64
0034:  RETFIE
64
0034:  RETFIE
65
0035:  BCF    0A.3
65
0035:  BCF    0A.3
66
0036:  GOTO   043
66
0036:  GOTO   037
67
.................... // ************************************* 
67
.................... // ************************************* 
68
.................... // * Scamnum Specularis ** 20. 9. 2006 * 
68
.................... // * Scamnum Specularis ** 20. 9. 2006 * 
69
.................... // ************************************* 
69
.................... // ************************************* 
70
....................  
70
....................  
71
.................... #include ".\menic.h" 
71
.................... #include ".\menic.h" 
72
.................... #include <16F88.h> 
72
.................... #include <16F88.h> 
73
.................... //////// Standard Header file for the PIC16F88 device //////////////// 
73
.................... //////// Standard Header file for the PIC16F88 device //////////////// 
74
.................... #device PIC16F88 
74
.................... #device PIC16F88 
75
.................... #list 
75
.................... #list 
76
....................  
76
....................  
77
....................  
77
....................  
78
.................... #device adc=8 
78
.................... #device adc=8 
79
....................  
79
....................  
80
.................... #fuses   WDT,INTRC_IO, NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, \ 
80
.................... #fuses   NOWDT,INTRC_IO, NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, \ 
81
....................          NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO, CCPB3 
81
....................          NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO, CCPB3 
82
....................  
82
....................  
83
.................... #use delay(clock=3900000,RESTART_WDT) 
83
.................... #use delay(clock=3900000,RESTART_WDT) 
84
*
84
*
85
0048:  MOVLW  6F
85
003C:  MOVLW  71
86
0049:  MOVWF  04
86
003D:  MOVWF  04
87
004A:  MOVF   00,W
87
003E:  MOVF   00,W
88
004B:  BTFSC  03.2
88
003F:  BTFSC  03.2
89
004C:  GOTO   05D
89
0040:  GOTO   051
90
004D:  MOVLW  01
90
0041:  MOVLW  01
91
004E:  MOVWF  78
91
0042:  MOVWF  78
92
004F:  MOVLW  BF
92
0043:  MOVLW  BF
93
0050:  MOVWF  77
93
0044:  MOVWF  77
94
0051:  CLRWDT
94
0045:  CLRWDT
95
0052:  DECFSZ 77,F
95
0046:  DECFSZ 77,F
96
0053:  GOTO   051
96
0047:  GOTO   045
97
0054:  DECFSZ 78,F
97
0048:  DECFSZ 78,F
98
0055:  GOTO   04F
98
0049:  GOTO   043
99
0056:  MOVLW  42
99
004A:  MOVLW  42
100
0057:  MOVWF  77
100
004B:  MOVWF  77
101
0058:  DECFSZ 77,F
101
004C:  DECFSZ 77,F
102
0059:  GOTO   058
102
004D:  GOTO   04C
103
005A:  CLRWDT
103
004E:  CLRWDT
104
005B:  DECFSZ 00,F
104
004F:  DECFSZ 00,F
105
005C:  GOTO   04D
105
0050:  GOTO   041
106
005D:  RETLW  00
106
0051:  RETLW  00
-
 
107
*
-
 
108
01B0:  MOVLW  12
-
 
109
01B1:  SUBWF  72,F
-
 
110
01B2:  BTFSS  03.0
-
 
111
01B3:  GOTO   1C2
-
 
112
01B4:  MOVLW  72
-
 
113
01B5:  MOVWF  04
-
 
114
01B6:  MOVLW  FC
-
 
115
01B7:  ANDWF  00,F
-
 
116
01B8:  BCF    03.0
-
 
117
01B9:  RRF    00,F
-
 
118
01BA:  RRF    00,F
-
 
119
01BB:  MOVF   00,W
-
 
120
01BC:  BTFSC  03.2
-
 
121
01BD:  GOTO   1C2
-
 
122
01BE:  GOTO   1C0
-
 
123
01BF:  CLRWDT
-
 
124
01C0:  DECFSZ 00,F
-
 
125
01C1:  GOTO   1BF
-
 
126
01C2:  RETLW  00
107
....................  
127
....................  
108
....................  
128
....................  
109
....................  
129
....................  
110
.................... #define  TXo PIN_B5           // To the transmitter modulator 
130
.................... #define  TXo PIN_B5           // To the transmitter modulator 
111
.................... #include ".\AX25.c"           // Podprogram pro prenos telemetrie 
131
.................... #include ".\AX25.c"           // Podprogram pro prenos telemetrie 
112
.................... //#define  PTT PIN_A2                 // PTT control 
132
.................... //#define  PTT PIN_A2                 // PTT control 
113
.................... //#define  TXo PIN_C0                 // To the transmitter modulator 
133
.................... //#define  TXo PIN_C0                 // To the transmitter modulator 
114
.................... //#define  PERIODAH delay_us(218)     // Halfperiod H 222;78/1200     500;430/500 
134
.................... //#define  PERIODAH delay_us(218)     // Halfperiod H 222;78/1200     500;430/500 
115
.................... //#define  TAILH delay_us(74) 
135
.................... //#define  TAILH delay_us(74) 
116
.................... //#define  PERIODAL delay_us(408)     // Halfperiod L 412;345/1200    1000;880/500 
136
.................... //#define  PERIODAL delay_us(408)     // Halfperiod L 412;345/1200    1000;880/500 
117
.................... //#define  TAILL delay_us(341) 
137
.................... //#define  TAILL delay_us(341) 
118
.................... #define  PERIODAH delay_us(222)     // Halfperiod H 222;78/1200     500;430/500 
138
.................... #define  PERIODAH delay_us(222)     // Halfperiod H 222;78/1200     500;430/500 
119
.................... #define  TAILH delay_us(78) 
139
.................... #define  TAILH delay_us(78) 
120
.................... #define  PERIODAL delay_us(412)     // Halfperiod L 412;345/1200    1000;880/500 
140
.................... #define  PERIODAL delay_us(412)     // Halfperiod L 412;345/1200    1000;880/500 
121
.................... #define  TAILL delay_us(345) 
141
.................... #define  TAILL delay_us(345) 
122
.................... #byte    STATUS = 3                 // CPUs status register 
142
.................... #byte    STATUS = 3                 // CPUs status register 
123
....................  
143
....................  
124
.................... byte SendData[16] = {'A'<<1, 'L'<<1, 'L'<<1, ' '<<1, ' '<<1, ' '<<1,  0x60, 
144
.................... byte SendData[16] = {'A'<<1, 'L'<<1, 'L'<<1, ' '<<1, ' '<<1, ' '<<1,  0x60, 
125
....................                      'C'<<1, 'Z'<<1, '0'<<1, 'R'<<1, 'R'<<1, 'R'<<1, 0x61, 
145
....................                      'C'<<1, 'Z'<<1, '0'<<1, 'R'<<1, 'R'<<1, 'R'<<1, 0x61, 
126
....................                      0x03, 0xF0}; 
146
....................                      0x03, 0xF0}; 
127
*
147
*
128
01C5:  MOVLW  82
148
01CE:  MOVLW  82
129
01C6:  BCF    03.5
149
01CF:  BCF    03.5
130
01C7:  MOVWF  29
150
01D0:  MOVWF  29
131
01C8:  MOVLW  98
151
01D1:  MOVLW  98
132
01C9:  MOVWF  2A
152
01D2:  MOVWF  2A
133
01CA:  MOVWF  2B
153
01D3:  MOVWF  2B
134
01CB:  MOVLW  40
154
01D4:  MOVLW  40
135
01CC:  MOVWF  2C
155
01D5:  MOVWF  2C
136
01CD:  MOVWF  2D
156
01D6:  MOVWF  2D
137
01CE:  MOVWF  2E
157
01D7:  MOVWF  2E
138
01CF:  MOVLW  60
158
01D8:  MOVLW  60
139
01D0:  MOVWF  2F
159
01D9:  MOVWF  2F
140
01D1:  MOVLW  86
160
01DA:  MOVLW  86
141
01D2:  MOVWF  30
161
01DB:  MOVWF  30
142
01D3:  MOVLW  B4
162
01DC:  MOVLW  B4
143
01D4:  MOVWF  31
163
01DD:  MOVWF  31
144
01D5:  MOVLW  60
164
01DE:  MOVLW  60
145
01D6:  MOVWF  32
165
01DF:  MOVWF  32
146
01D7:  MOVLW  A4
166
01E0:  MOVLW  A4
147
01D8:  MOVWF  33
167
01E1:  MOVWF  33
148
01D9:  MOVWF  34
168
01E2:  MOVWF  34
149
01DA:  MOVWF  35
169
01E3:  MOVWF  35
150
01DB:  MOVLW  61
170
01E4:  MOVLW  61
151
01DC:  MOVWF  36
171
01E5:  MOVWF  36
152
01DD:  MOVLW  03
172
01E6:  MOVLW  03
153
01DE:  MOVWF  37
173
01E7:  MOVWF  37
154
01DF:  MOVLW  F0
174
01E8:  MOVLW  F0
155
01E0:  MOVWF  38
175
01E9:  MOVWF  38
156
....................  
176
....................  
157
.................... boolean bit; 
177
.................... boolean bit; 
158
.................... int fcslo, fcshi;    // variabloes for calculating FCS (CRC) 
178
.................... int fcslo, fcshi;    // variabloes for calculating FCS (CRC) 
159
.................... int stuff;           // stuff counter for extra 0 
179
.................... int stuff;           // stuff counter for extra 0 
160
.................... int flag_flag;       // if it is sending flag (7E) 
180
.................... int flag_flag;       // if it is sending flag (7E) 
161
.................... int fcs_flag;        // if it is sending Frame Check Sequence 
181
.................... int fcs_flag;        // if it is sending Frame Check Sequence 
162
.................... int i;               // for for 
182
.................... int i;               // for for 
163
....................  
183
....................  
164
.................... void flipout()       //flips the state of output pin a_1 
184
.................... void flipout()       //flips the state of output pin a_1 
165
.................... { 
185
.................... { 
166
.................... 	stuff = 0;        //since this is a 0, reset the stuff counter 
186
.................... 	stuff = 0;        //since this is a 0, reset the stuff counter 
167
*
187
*
168
00E7:  CLRF   3C
188
00DD:  CLRF   3C
169
.................... 	if (bit) 
189
.................... 	if (bit) 
170
00E8:  BTFSS  39.0
190
00DE:  BTFSS  39.0
171
00E9:  GOTO   0EC
191
00DF:  GOTO   0E2
172
....................    { 
192
....................    { 
173
....................      bit=FALSE;      //if the state of the pin was low, make it high. 
193
....................      bit=FALSE;      //if the state of the pin was low, make it high. 
174
00EA:  BCF    39.0
194
00E0:  BCF    39.0
175
....................    } 
195
....................    } 
176
....................    else 
196
....................    else 
177
00EB:  GOTO   0ED
197
00E1:  GOTO   0E3
178
....................    { 
198
....................    { 
179
....................      bit=TRUE;	  	   //if the state of the pin was high make it low 
199
....................      bit=TRUE;	  	   //if the state of the pin was high make it low 
180
00EC:  BSF    39.0
200
00E2:  BSF    39.0
181
....................    } 
201
....................    } 
182
.................... } 
202
.................... } 
183
00ED:  RETLW  00
203
00E3:  RETLW  00
184
....................  
204
....................  
185
.................... void fcsbit(byte tbyte) 
205
.................... void fcsbit(byte tbyte) 
186
.................... { 
206
.................... { 
187
.................... #asm 
207
.................... #asm 
188
....................    BCF    STATUS,0 
208
....................    BCF    STATUS,0 
189
*
209
*
190
0149:  BCF    03.0
210
013F:  BCF    03.0
191
....................    RRF    fcshi,F             // rotates the entire 16 bits 
211
....................    RRF    fcshi,F             // rotates the entire 16 bits 
192
014A:  RRF    3B,F
212
0140:  RRF    3B,F
193
....................    RRF    fcslo,F			      // to the right 
213
....................    RRF    fcslo,F			      // to the right 
194
014B:  RRF    3A,F
214
0141:  RRF    3A,F
195
.................... #endasm 
215
.................... #endasm 
196
....................    if (((STATUS & 0x01)^(tbyte)) ==0x01) 
216
....................    if (((STATUS & 0x01)^(tbyte)) ==0x01) 
197
014C:  MOVF   03,W
217
0142:  MOVF   03,W
198
014D:  ANDLW  01
218
0143:  ANDLW  01
199
014E:  XORWF  73,W
219
0144:  XORWF  75,W
200
014F:  SUBLW  01
220
0145:  SUBLW  01
201
0150:  BTFSS  03.2
221
0146:  BTFSS  03.2
202
0151:  GOTO   156
222
0147:  GOTO   14C
203
....................    { 
223
....................    { 
204
....................          fcshi = fcshi^0x84; 
224
....................          fcshi = fcshi^0x84; 
205
0152:  MOVLW  84
225
0148:  MOVLW  84
206
0153:  XORWF  3B,F
226
0149:  XORWF  3B,F
207
....................          fcslo = fcslo^0x08; 
227
....................          fcslo = fcslo^0x08; 
208
0154:  MOVLW  08
228
014A:  MOVLW  08
209
0155:  XORWF  3A,F
229
014B:  XORWF  3A,F
210
....................    } 
230
....................    } 
211
.................... } 
231
.................... } 
212
....................  
232
....................  
213
.................... void SendBit () 
233
.................... void SendBit () 
214
.................... { 
234
.................... { 
215
.................... 	if (bit) 
235
.................... 	if (bit) 
216
*
236
*
217
00EE:  BTFSS  39.0
237
00E4:  BTFSS  39.0
218
00EF:  GOTO   11A
238
00E5:  GOTO   110
219
....................    { 
239
....................    { 
220
....................       output_low(TXo); 
240
....................       output_low(TXo); 
-
 
241
00E6:  BSF    03.5
-
 
242
00E7:  BCF    06.5
-
 
243
00E8:  BCF    03.5
-
 
244
00E9:  BCF    06.5
-
 
245
....................       PERIODAH; 
-
 
246
00EA:  CLRWDT
-
 
247
00EB:  MOVLW  47
-
 
248
00EC:  MOVWF  77
-
 
249
00ED:  DECFSZ 77,F
-
 
250
00EE:  GOTO   0ED
-
 
251
00EF:  NOP
-
 
252
....................       output_high(TXo); 
221
00F0:  BSF    03.5
253
00F0:  BSF    03.5
222
00F1:  BCF    06.5
254
00F1:  BCF    06.5
223
00F2:  BCF    03.5
255
00F2:  BCF    03.5
224
00F3:  BCF    06.5
256
00F3:  BSF    06.5
225
....................       PERIODAH; 
257
....................       PERIODAH; 
226
00F4:  CLRWDT
258
00F4:  CLRWDT
227
00F5:  MOVLW  47
259
00F5:  MOVLW  47
228
00F6:  MOVWF  77
260
00F6:  MOVWF  77
229
00F7:  DECFSZ 77,F
261
00F7:  DECFSZ 77,F
230
00F8:  GOTO   0F7
262
00F8:  GOTO   0F7
231
00F9:  NOP
263
00F9:  NOP
232
....................       output_high(TXo); 
264
....................       output_low(TXo); 
233
00FA:  BSF    03.5
265
00FA:  BSF    03.5
234
00FB:  BCF    06.5
266
00FB:  BCF    06.5
235
00FC:  BCF    03.5
267
00FC:  BCF    03.5
236
00FD:  BSF    06.5
268
00FD:  BCF    06.5
237
....................       PERIODAH; 
269
....................       PERIODAH; 
238
00FE:  CLRWDT
270
00FE:  CLRWDT
239
00FF:  MOVLW  47
271
00FF:  MOVLW  47
240
0100:  MOVWF  77
272
0100:  MOVWF  77
241
0101:  DECFSZ 77,F
273
0101:  DECFSZ 77,F
242
0102:  GOTO   101
274
0102:  GOTO   101
243
0103:  NOP
275
0103:  NOP
244
....................       output_low(TXo); 
276
....................       output_high(TXo); 
245
0104:  BSF    03.5
277
0104:  BSF    03.5
246
0105:  BCF    06.5
278
0105:  BCF    06.5
247
0106:  BCF    03.5
279
0106:  BCF    03.5
248
0107:  BCF    06.5
280
0107:  BSF    06.5
249
....................       PERIODAH; 
281
....................       TAILH; 
250
0108:  CLRWDT
282
0108:  CLRWDT
251
0109:  MOVLW  47
283
0109:  MOVLW  18
252
010A:  MOVWF  77
284
010A:  MOVWF  77
253
010B:  DECFSZ 77,F
285
010B:  DECFSZ 77,F
254
010C:  GOTO   10B
286
010C:  GOTO   10B
255
010D:  NOP
287
010D:  NOP
256
....................       output_high(TXo); 
-
 
257
010E:  BSF    03.5
-
 
258
010F:  BCF    06.5
-
 
259
0110:  BCF    03.5
-
 
260
0111:  BSF    06.5
-
 
261
....................       TAILH; 
-
 
262
0112:  CLRWDT
-
 
263
0113:  MOVLW  18
-
 
264
0114:  MOVWF  77
-
 
265
0115:  DECFSZ 77,F
-
 
266
0116:  GOTO   115
-
 
267
0117:  NOP
-
 
268
0118:  NOP
288
010E:  NOP
269
....................     } 
289
....................     } 
270
....................     else 
290
....................     else 
271
0119:  GOTO   12D
291
010F:  GOTO   123
272
....................     { 
292
....................     { 
273
....................       output_low(TXo); 
293
....................       output_low(TXo); 
274
011A:  BSF    03.5
294
0110:  BSF    03.5
275
011B:  BCF    06.5
295
0111:  BCF    06.5
276
011C:  BCF    03.5
296
0112:  BCF    03.5
277
011D:  BCF    06.5
297
0113:  BCF    06.5
278
....................       PERIODAL; 
298
....................       PERIODAL; 
279
011E:  CLRWDT
299
0114:  CLRWDT
280
011F:  MOVLW  85
300
0115:  MOVLW  85
281
0120:  MOVWF  77
301
0116:  MOVWF  77
282
0121:  DECFSZ 77,F
302
0117:  DECFSZ 77,F
283
0122:  GOTO   121
303
0118:  GOTO   117
284
....................       output_high(TXo); 
304
....................       output_high(TXo); 
285
0123:  BSF    03.5
305
0119:  BSF    03.5
286
0124:  BCF    06.5
306
011A:  BCF    06.5
287
0125:  BCF    03.5
307
011B:  BCF    03.5
288
0126:  BSF    06.5
308
011C:  BSF    06.5
289
....................       TAILL; 
309
....................       TAILL; 
290
0127:  CLRWDT
310
011D:  CLRWDT
291
0128:  MOVLW  6F
311
011E:  MOVLW  6F
292
0129:  MOVWF  77
312
011F:  MOVWF  77
293
012A:  DECFSZ 77,F
313
0120:  DECFSZ 77,F
294
012B:  GOTO   12A
314
0121:  GOTO   120
295
012C:  NOP
315
0122:  NOP
296
....................     }; 
316
....................     }; 
297
.................... } 
317
.................... } 
298
012D:  RETLW  00
318
0123:  RETLW  00
299
....................  
319
....................  
300
.................... void SendByte (byte inbyte) 
320
.................... void SendByte (byte inbyte) 
301
.................... { 
321
.................... { 
302
....................    int k, bt; 
322
....................    int k, bt; 
303
....................  
323
....................  
304
....................    for (k=0;k<8;k++)    //do the following for each of the 8 bits in the byte 
324
....................    for (k=0;k<8;k++)    //do the following for each of the 8 bits in the byte 
305
012E:  CLRF   71
325
0124:  CLRF   73
306
012F:  MOVF   71,W
326
0125:  MOVF   73,W
307
0130:  SUBLW  07
327
0126:  SUBLW  07
308
0131:  BTFSS  03.0
328
0127:  BTFSS  03.0
309
0132:  GOTO   176
329
0128:  GOTO   16C
310
....................    { 
330
....................    { 
311
....................      bt = inbyte & 0x01;            //strip off the rightmost bit of the byte to be sent (inbyte) 
331
....................      bt = inbyte & 0x01;            //strip off the rightmost bit of the byte to be sent (inbyte) 
312
0133:  MOVF   70,W
332
0129:  MOVF   72,W
313
0134:  ANDLW  01
333
012A:  ANDLW  01
314
0135:  MOVWF  72
334
012B:  MOVWF  74
315
....................      if ((fcs_flag == FALSE) & (flag_flag == FALSE)) fcsbit(bt);    //do FCS calc, but only if this 
335
....................      if ((fcs_flag == FALSE) & (flag_flag == FALSE)) fcsbit(bt);    //do FCS calc, but only if this 
316
0136:  MOVF   3E,F
336
012C:  MOVF   3E,F
317
0137:  BTFSC  03.2
337
012D:  BTFSC  03.2
318
0138:  GOTO   13B
338
012E:  GOTO   131
319
0139:  MOVLW  00
339
012F:  MOVLW  00
320
013A:  GOTO   13C
340
0130:  GOTO   132
321
013B:  MOVLW  01
341
0131:  MOVLW  01
322
013C:  MOVWF  73
342
0132:  MOVWF  75
323
013D:  MOVF   3D,F
343
0133:  MOVF   3D,F
324
013E:  BTFSC  03.2
344
0134:  BTFSC  03.2
325
013F:  GOTO   142
345
0135:  GOTO   138
326
0140:  MOVLW  00
346
0136:  MOVLW  00
327
0141:  GOTO   143
347
0137:  GOTO   139
328
0142:  MOVLW  01
348
0138:  MOVLW  01
329
0143:  ANDWF  73,W
349
0139:  ANDWF  75,W
330
0144:  XORLW  00
350
013A:  XORLW  00
331
0145:  BTFSC  03.2
351
013B:  BTFSC  03.2
332
0146:  GOTO   156
352
013C:  GOTO   14C
333
0147:  MOVF   72,W
353
013D:  MOVF   74,W
334
0148:  MOVWF  73
354
013E:  MOVWF  75
335
.................... 						                                                //is not a flag or fcs byte 
355
.................... 						                                                //is not a flag or fcs byte 
336
....................      if (bt == 0) 
356
....................      if (bt == 0) 
337
*
357
*
338
0156:  MOVF   72,F
358
014C:  MOVF   74,F
339
0157:  BTFSS  03.2
359
014D:  BTFSS  03.2
340
0158:  GOTO   15B
360
014E:  GOTO   151
341
....................      { 
361
....................      { 
342
....................        flipout(); 
362
....................        flipout(); 
343
0159:  CALL   0E7
363
014F:  CALL   0DD
344
....................      }  			               // if this bit is a zero, flip the output state 
364
....................      }  			               // if this bit is a zero, flip the output state 
345
....................      else 
365
....................      else 
346
015A:  GOTO   171
366
0150:  GOTO   167
347
....................      {                          			      //otherwise if it is a 1, do the following: 
367
....................      {                          			      //otherwise if it is a 1, do the following: 
348
....................        if (flag_flag == FALSE) stuff++;      //increment the count of consequtive 1's 
368
....................        if (flag_flag == FALSE) stuff++;      //increment the count of consequtive 1's 
349
015B:  MOVF   3D,F
369
0151:  MOVF   3D,F
350
015C:  BTFSC  03.2
370
0152:  BTFSC  03.2
351
015D:  INCF   3C,F
371
0153:  INCF   3C,F
352
....................        if ((flag_flag == FALSE) & (stuff == 5)) 
372
....................        if ((flag_flag == FALSE) & (stuff == 5)) 
353
015E:  MOVF   3D,F
373
0154:  MOVF   3D,F
354
015F:  BTFSC  03.2
374
0155:  BTFSC  03.2
355
0160:  GOTO   163
375
0156:  GOTO   159
356
0161:  MOVLW  00
376
0157:  MOVLW  00
357
0162:  GOTO   164
377
0158:  GOTO   15A
358
0163:  MOVLW  01
378
0159:  MOVLW  01
359
0164:  MOVWF  73
379
015A:  MOVWF  75
360
0165:  MOVF   3C,W
380
015B:  MOVF   3C,W
361
0166:  SUBLW  05
381
015C:  SUBLW  05
362
0167:  BTFSC  03.2
382
015D:  BTFSC  03.2
363
0168:  GOTO   16B
383
015E:  GOTO   161
364
0169:  MOVLW  00
384
015F:  MOVLW  00
365
016A:  GOTO   16C
385
0160:  GOTO   162
366
016B:  MOVLW  01
386
0161:  MOVLW  01
367
016C:  ANDWF  73,W
387
0162:  ANDWF  75,W
368
016D:  BTFSC  03.2
388
0163:  BTFSC  03.2
369
016E:  GOTO   171
389
0164:  GOTO   167
370
....................        {       //stuff an extra 0, if 5 1's in a row 
390
....................        {       //stuff an extra 0, if 5 1's in a row 
371
....................          SendBit(); 
391
....................          SendBit(); 
372
016F:  CALL   0EE
392
0165:  CALL   0E4
373
....................          flipout();               //flip the output state to stuff a 0 
393
....................          flipout();               //flip the output state to stuff a 0 
374
0170:  CALL   0E7
394
0166:  CALL   0DD
375
....................        }//end of if 
395
....................        }//end of if 
376
....................      }//end of else 
396
....................      }//end of else 
377
....................      // delay_us(850);				 //introduces a delay that creates 1200 baud 
397
....................      // delay_us(850);				 //introduces a delay that creates 1200 baud 
378
....................      SendBit(); 
398
....................      SendBit(); 
379
0171:  CALL   0EE
399
0167:  CALL   0E4
380
....................      inbyte = inbyte>>1;          //go to the next bit in the byte 
400
....................      inbyte = inbyte>>1;          //go to the next bit in the byte 
381
0172:  BCF    03.0
401
0168:  BCF    03.0
382
0173:  RRF    70,F
402
0169:  RRF    72,F
383
....................    }//end of for 
403
....................    }//end of for 
384
0174:  INCF   71,F
404
016A:  INCF   73,F
385
0175:  GOTO   12F
405
016B:  GOTO   125
386
.................... }//end of SendByte 
406
.................... }//end of SendByte 
387
0176:  RETLW  00
407
016C:  RETLW  00
388
....................  
408
....................  
389
.................... void SendPacket(char *data) 
409
.................... void SendPacket(char *data) 
390
.................... { 
410
.................... { 
391
....................     bit=FALSE; 
411
....................     bit=FALSE; 
392
0177:  BCF    39.0
412
016D:  BCF    39.0
393
....................  
413
....................  
394
....................    fcslo=fcshi=0xFF;       //The 2 FCS Bytes are initialized to FF 
414
....................    fcslo=fcshi=0xFF;       //The 2 FCS Bytes are initialized to FF 
395
0178:  MOVLW  FF
415
016E:  MOVLW  FF
396
0179:  MOVWF  3B
416
016F:  MOVWF  3B
397
017A:  MOVWF  3A
417
0170:  MOVWF  3A
398
....................    stuff = 0;              //The variable stuff counts the number of 1's in a row. When it gets to 5 
418
....................    stuff = 0;              //The variable stuff counts the number of 1's in a row. When it gets to 5 
399
017B:  CLRF   3C
419
0171:  CLRF   3C
400
.................... 		                     // it is time to stuff a 0. 
420
.................... 		                     // it is time to stuff a 0. 
401
....................  
421
....................  
402
.................... //   output_low(PTT);        // Blinking LED 
422
.................... //   output_low(PTT);        // Blinking LED 
403
.................... //   delay_ms(1000); 
423
.................... //   delay_ms(1000); 
404
.................... //   output_high(PTT); 
424
.................... //   output_high(PTT); 
405
....................  
425
....................  
406
....................    flag_flag = TRUE;       //The variable flag is true if you are transmitted flags (7E's) false otherwise. 
426
....................    flag_flag = TRUE;       //The variable flag is true if you are transmitted flags (7E's) false otherwise. 
407
017C:  MOVLW  01
427
0172:  MOVLW  01
408
017D:  MOVWF  3D
428
0173:  MOVWF  3D
409
....................    fcs_flag = FALSE;       //The variable fcsflag is true if you are transmitting FCS bytes, false otherwise. 
429
....................    fcs_flag = FALSE;       //The variable fcsflag is true if you are transmitting FCS bytes, false otherwise. 
410
017E:  CLRF   3E
430
0174:  CLRF   3E
411
....................  
431
....................  
412
....................    for(i=0; i<10; i++) SendByte(0x7E); //Sends flag bytes.  Adjust length for txdelay 
432
....................    for(i=0; i<10; i++) SendByte(0x7E); //Sends flag bytes.  Adjust length for txdelay 
413
017F:  CLRF   3F
433
0175:  CLRF   3F
414
0180:  MOVF   3F,W
434
0176:  MOVF   3F,W
415
0181:  SUBLW  09
435
0177:  SUBLW  09
416
0182:  BTFSS  03.0
436
0178:  BTFSS  03.0
417
0183:  GOTO   189
437
0179:  GOTO   17F
418
0184:  MOVLW  7E
438
017A:  MOVLW  7E
419
0185:  MOVWF  70
439
017B:  MOVWF  72
420
0186:  CALL   12E
440
017C:  CALL   124
421
0187:  INCF   3F,F
441
017D:  INCF   3F,F
422
0188:  GOTO   180
442
017E:  GOTO   176
423
....................                                        //each flag takes approx 6.7 ms 
443
....................                                        //each flag takes approx 6.7 ms 
424
....................    flag_flag = FALSE;      //done sending flags 
444
....................    flag_flag = FALSE;      //done sending flags 
425
0189:  CLRF   3D
445
017F:  CLRF   3D
426
....................  
446
....................  
427
....................    for(i=0; i<16; i++) SendByte(SendData[i]);      //send the packet bytes 
447
....................    for(i=0; i<16; i++) SendByte(SendData[i]);      //send the packet bytes 
428
018A:  CLRF   3F
448
0180:  CLRF   3F
429
018B:  MOVF   3F,W
449
0181:  MOVF   3F,W
430
018C:  SUBLW  0F
450
0182:  SUBLW  0F
431
018D:  BTFSS  03.0
451
0183:  BTFSS  03.0
432
018E:  GOTO   198
452
0184:  GOTO   18E
433
018F:  MOVLW  29
453
0185:  MOVLW  29
434
0190:  ADDWF  3F,W
454
0186:  ADDWF  3F,W
435
0191:  MOVWF  04
455
0187:  MOVWF  04
436
0192:  MOVF   00,W
456
0188:  MOVF   00,W
437
0193:  MOVWF  6F
457
0189:  MOVWF  71
438
0194:  MOVWF  70
458
018A:  MOVWF  72
439
0195:  CALL   12E
459
018B:  CALL   124
440
0196:  INCF   3F,F
460
018C:  INCF   3F,F
441
0197:  GOTO   18B
461
018D:  GOTO   181
442
....................  
462
....................  
443
....................    for(i=0; 0 != *data; i++) 
463
....................    for(i=0; 0 != *data; i++) 
444
0198:  CLRF   3F
464
018E:  CLRF   3F
445
0199:  MOVF   6E,W
465
018F:  MOVF   70,W
446
019A:  MOVWF  04
466
0190:  MOVWF  04
447
019B:  MOVF   00,W
467
0191:  MOVF   00,W
448
019C:  BTFSC  03.2
468
0192:  BTFSC  03.2
449
019D:  GOTO   1A7
469
0193:  GOTO   19D
450
....................    { 
470
....................    { 
451
....................       SendByte(*data);     //send the packet bytes 
471
....................       SendByte(*data);     //send the packet bytes 
452
019E:  MOVF   6E,W
472
0194:  MOVF   70,W
453
019F:  MOVWF  04
473
0195:  MOVWF  04
454
01A0:  MOVF   00,W
474
0196:  MOVF   00,W
455
01A1:  MOVWF  6F
475
0197:  MOVWF  71
456
01A2:  MOVWF  70
476
0198:  MOVWF  72
457
01A3:  CALL   12E
477
0199:  CALL   124
458
....................       data++; 
478
....................       data++; 
459
01A4:  INCF   6E,F
479
019A:  INCF   70,F
460
....................    }; 
480
....................    }; 
461
01A5:  INCF   3F,F
481
019B:  INCF   3F,F
462
01A6:  GOTO   199
482
019C:  GOTO   18F
463
....................  
483
....................  
464
....................    fcs_flag = TRUE;       	//about to send the FCS bytes 
484
....................    fcs_flag = TRUE;       	//about to send the FCS bytes 
465
01A7:  MOVLW  01
485
019D:  MOVLW  01
466
01A8:  MOVWF  3E
486
019E:  MOVWF  3E
467
....................    fcslo =fcslo^0xff;      //must XOR them with FF before sending 
487
....................    fcslo =fcslo^0xff;      //must XOR them with FF before sending 
468
01A9:  MOVLW  FF
488
019F:  MOVLW  FF
469
01AA:  XORWF  3A,F
489
01A0:  XORWF  3A,F
470
....................    fcshi = fcshi^0xff; 
490
....................    fcshi = fcshi^0xff; 
471
01AB:  XORWF  3B,F
491
01A1:  XORWF  3B,F
472
....................    SendByte(fcslo);        //send the low byte of fcs 
492
....................    SendByte(fcslo);        //send the low byte of fcs 
473
01AC:  MOVF   3A,W
493
01A2:  MOVF   3A,W
474
01AD:  MOVWF  70
494
01A3:  MOVWF  72
475
01AE:  CALL   12E
495
01A4:  CALL   124
476
....................    SendByte(fcshi);        //send the high byte of fcs 
496
....................    SendByte(fcshi);        //send the high byte of fcs 
477
01AF:  MOVF   3B,W
497
01A5:  MOVF   3B,W
478
01B0:  MOVWF  70
498
01A6:  MOVWF  72
479
01B1:  CALL   12E
499
01A7:  CALL   124
480
....................    fcs_flag = FALSE;		   //done sending FCS 
500
....................    fcs_flag = FALSE;		   //done sending FCS 
481
01B2:  CLRF   3E
501
01A8:  CLRF   3E
482
....................    flag_flag = TRUE;  		//about to send flags 
502
....................    flag_flag = TRUE;  		//about to send flags 
483
01B3:  MOVLW  01
503
01A9:  MOVLW  01
484
01B4:  MOVWF  3D
504
01AA:  MOVWF  3D
485
....................    SendByte(0x7e);         // Send a flag to end packet 
505
....................    SendByte(0x7e);         // Send a flag to end packet 
486
01B5:  MOVLW  7E
506
01AB:  MOVLW  7E
487
01B6:  MOVWF  70
507
01AC:  MOVWF  72
488
01B7:  CALL   12E
508
01AD:  CALL   124
489
.................... } 
509
.................... } 
490
01B8:  BCF    0A.3
510
01AE:  BCF    0A.3
491
01B9:  GOTO   30C (RETURN)
511
01AF:  GOTO   2FD (RETURN)
492
....................  
512
....................  
493
....................  
513
....................  
494
....................  
514
....................  
495
....................  
515
....................  
496
.................... char AXstring[40];            // Buffer pro prenos telemetrie 
516
.................... char AXstring[40];            // Buffer pro prenos telemetrie 
497
....................  
517
....................  
498
.................... #define REFSTART  95    // Hodnota odpovidajici 1,2V pri nezatizenych clancich 
518
.................... #define REFSTART  95    // Hodnota odpovidajici 1,2V pri nezatizenych clancich 
499
.................... #define DUTY1     2     // Delka sepnuti PWM v us pro sero 
519
.................... #define DUTY1     2     // Delka sepnuti PWM v us pro sero 
500
.................... #define DUTY2     19    // Delka sepnuti PWM v us pro jednu zarovku 500W 
520
.................... #define DUTY2     19    // Delka sepnuti PWM v us pro jednu zarovku 500W 
501
....................  
521
....................  
502
.................... // Tabulka hodnot prevodniku pro ruzna napajeci napeti 
522
.................... // Tabulka hodnot prevodniku pro ruzna napajeci napeti 
503
.................... //  80   3,99V 
523
.................... //  80   3,99V 
504
.................... //  90   3,54V 
524
.................... //  90   3,54V 
505
.................... // 100   3,20V 
525
.................... // 100   3,20V 
506
.................... // 105   3,04V 
526
.................... // 105   3,04V 
507
.................... // 107   2,99V 
527
.................... // 107   2,99V 
508
.................... // 110   2,91v 
528
.................... // 110   2,91v 
509
.................... // 200   1,61V 
529
.................... // 200   1,61V 
510
....................  
530
....................  
511
.................... #define PIEZO     PIN_A6   // Jeden pol piezo reproduktoru 
531
.................... #define PIEZO     PIN_A6   // Jeden pol piezo reproduktoru 
512
.................... #define LED       PIN_A7   // LED / druhy pol piezo reproduktoru 
532
.................... #define LED       PIN_A7   // LED / druhy pol piezo reproduktoru 
513
.................... #define MENIC     PIN_B3   // Spinani tranzistoru menice 
533
.................... #define MENIC     PIN_B3   // Spinani tranzistoru menice 
514
.................... #define REFPWR    PIN_B1   // Napajeni zdroje referencniho napeti 
534
.................... #define REFPWR    PIN_B1   // Napajeni zdroje referencniho napeti 
515
.................... #define MOTOR     PIN_B2   // Spinani tranzistoru motoru 
535
.................... #define MOTOR     PIN_B2   // Spinani tranzistoru motoru 
516
.................... #define SW1       PIN_B6   // DIPswitch 1 
536
.................... #define SW1       PIN_B6   // DIPswitch 1 
517
.................... #define SW2       PIN_B7   // DIPswitch 2 
537
.................... #define SW2       PIN_B7   // DIPswitch 2 
518
.................... #define NAPETI    4        // Cislo kanalu DA prevodniku pro mereni napeti 
538
.................... #define NAPETI    4        // Cislo kanalu DA prevodniku pro mereni napeti 
519
.................... #define PWM       0        // Cislo kanalu DA prevodniku pro nastaveni PWM 
539
.................... #define PWM       0        // Cislo kanalu DA prevodniku pro nastaveni PWM 
520
.................... #define ROZJEZD   1        // Cislo kanalu DA prevodniku pro nastaveni rozjezdu 
540
.................... #define ROZJEZD   1        // Cislo kanalu DA prevodniku pro nastaveni rozjezdu 
521
....................  
541
....................  
522
.................... #byte SSPBUF   = 0x13   // Adresy registru jednotky SSP 
542
.................... #byte SSPBUF   = 0x13   // Adresy registru jednotky SSP 
523
.................... #byte SSPCON1  = 0x14 
543
.................... #byte SSPCON1  = 0x14 
524
.................... #byte SSPSTAT  = 0x94 
544
.................... #byte SSPSTAT  = 0x94 
525
....................  
545
....................  
526
.................... // Vzorky pro generovani PWM pomoci SSP 
546
.................... // Vzorky pro generovani PWM pomoci SSP 
527
.................... unsigned int8 const Pattern[8] = {0x02,0x06,0x0e,0x1e,0x3e,0x7e,0xfe,0xff}; 
547
.................... unsigned int8 const Pattern[8] = {0x02,0x06,0x0e,0x1e,0x3e,0x7e,0xfe,0xff}; 
528
.................... unsigned int8 MotorPattern; 
548
.................... unsigned int8 MotorPattern; 
529
....................  
549
....................  
530
.................... #INT_SSP 
550
.................... #INT_SSP 
531
.................... void IntSSP() 
551
.................... void IntSSP() 
532
.................... { 
552
.................... { 
533
....................    SSPBUF=MotorPattern;             // znovu vysli stejnou hodnotu 
553
....................    SSPBUF=MotorPattern;             // znovu vysli stejnou hodnotu 
534
*
554
*
535
0043:  MOVF   68,W
555
0037:  MOVF   68,W
536
0044:  MOVWF  13
556
0038:  MOVWF  13
537
.................... } 
557
.................... } 
538
....................  
558
....................  
539
0045:  BCF    0C.3
559
0039:  BCF    0C.3
540
0046:  BCF    0A.3
560
003A:  BCF    0A.3
541
0047:  GOTO   022
561
003B:  GOTO   022
542
.................... void pip()     // pipnuti a bliknuti 
562
.................... void pip()     // pipnuti a bliknuti 
543
.................... { 
563
.................... { 
544
....................    int1 beep; 
564
....................    int1 beep; 
545
....................    int i; 
565
....................    int i; 
546
....................  
566
....................  
547
....................    for(i=0; i<250; i++) 
567
....................    for(i=0; i<250; i++) 
548
*
568
*
549
006B:  CLRF   6F
569
005F:  CLRF   71
550
006C:  MOVF   6F,W
570
0060:  MOVF   71,W
551
006D:  SUBLW  F9
571
0061:  SUBLW  F9
552
006E:  BTFSS  03.0
572
0062:  BTFSS  03.0
553
006F:  GOTO   08B
573
0063:  GOTO   081
554
....................    { 
574
....................    { 
555
....................       output_bit(PIEZO, beep); 
575
....................       output_bit(PIEZO, beep); 
556
0070:  BTFSC  6E.0
576
0064:  BTFSC  70.0
557
0071:  GOTO   074
577
0065:  GOTO   068
558
0072:  BCF    05.6
578
0066:  BCF    05.6
559
0073:  GOTO   075
579
0067:  GOTO   069
560
0074:  BSF    05.6
580
0068:  BSF    05.6
561
0075:  BSF    03.5
581
0069:  BSF    03.5
562
0076:  BCF    05.6
582
006A:  BCF    05.6
563
....................       beep=~beep; 
583
....................       beep=~beep; 
564
0077:  MOVLW  01
584
006B:  MOVLW  01
565
0078:  BCF    03.5
-
 
566
0079:  XORWF  6E,F
585
006C:  XORWF  70,F
567
....................       output_bit(LED, beep); 
586
....................       output_bit(LED, beep); 
568
007A:  BTFSC  6E.0
587
006D:  BTFSC  70.0
569
007B:  GOTO   07E
588
006E:  GOTO   073
-
 
589
006F:  BCF    03.5
570
007C:  BCF    05.7
590
0070:  BCF    05.7
571
007D:  GOTO   07F
591
0071:  GOTO   075
-
 
592
0072:  BSF    03.5
-
 
593
0073:  BCF    03.5
572
007E:  BSF    05.7
594
0074:  BSF    05.7
573
007F:  BSF    03.5
595
0075:  BSF    03.5
574
0080:  BCF    05.7
596
0076:  BCF    05.7
575
....................       delay_us(100); 
597
....................       delay_us(100); 
576
0081:  CLRWDT
598
0077:  CLRWDT
577
0082:  MOVLW  1F
599
0078:  MOVLW  1F
578
0083:  MOVWF  77
600
0079:  MOVWF  77
579
0084:  DECFSZ 77,F
601
007A:  DECFSZ 77,F
580
0085:  GOTO   084
602
007B:  GOTO   07A
581
0086:  NOP
603
007C:  NOP
582
0087:  NOP
604
007D:  NOP
583
....................    }; 
605
....................    }; 
584
0088:  BCF    03.5
606
007E:  INCF   71,F
585
0089:  INCF   6F,F
607
007F:  BCF    03.5
586
008A:  GOTO   06C
608
0080:  GOTO   060
587
....................    output_high(PIEZO); 
609
....................    output_high(PIEZO); 
588
008B:  BSF    03.5
610
0081:  BSF    03.5
589
008C:  BCF    05.6
611
0082:  BCF    05.6
590
008D:  BCF    03.5
612
0083:  BCF    03.5
591
008E:  BSF    05.6
613
0084:  BSF    05.6
592
....................    output_high(LED); 
614
....................    output_high(LED); 
593
008F:  BSF    03.5
615
0085:  BSF    03.5
594
0090:  BCF    05.7
616
0086:  BCF    05.7
595
0091:  BCF    03.5
617
0087:  BCF    03.5
596
0092:  BSF    05.7
618
0088:  BSF    05.7
597
.................... } 
619
.................... } 
598
0093:  BCF    0A.3
620
0089:  BCF    0A.3
599
0094:  GOTO   2A3 (RETURN)
621
008A:  GOTO   2B1 (RETURN)
600
....................  
622
....................  
601
.................... void cvak()    // pouze cvaknuti piezoelementem bez bliknuti 
623
.................... void cvak()    // pouze cvaknuti piezoelementem bez bliknuti 
602
.................... { 
624
.................... { 
603
....................    output_bit(PIEZO,~input(PIEZO)); 
625
....................    output_bit(PIEZO,~input(PIEZO)); 
604
*
626
*
605
005E:  BSF    03.5
627
0052:  BSF    03.5
606
005F:  BSF    05.6
628
0053:  BSF    05.6
607
0060:  BCF    03.5
629
0054:  BCF    03.5
608
0061:  BTFSS  05.6
630
0055:  BTFSS  05.6
609
0062:  GOTO   065
631
0056:  GOTO   059
610
0063:  BCF    05.6
632
0057:  BCF    05.6
611
0064:  GOTO   066
633
0058:  GOTO   05A
612
0065:  BSF    05.6
634
0059:  BSF    05.6
613
0066:  BSF    03.5
635
005A:  BSF    03.5
614
0067:  BCF    05.6
636
005B:  BCF    05.6
615
.................... } 
637
.................... } 
616
0068:  BCF    03.5
638
005C:  BCF    03.5
617
0069:  BCF    0A.3
639
005D:  BCF    0A.3
618
006A:  GOTO   25A (RETURN)
640
005E:  GOTO   263 (RETURN)
619
....................  
641
....................  
620
.................... void main() 
642
.................... void main() 
621
.................... { 
643
.................... { 
622
*
644
*
623
01BA:  CLRF   04
645
01C3:  CLRF   04
624
01BB:  MOVLW  1F
646
01C4:  MOVLW  1F
625
01BC:  ANDWF  03,F
647
01C5:  ANDWF  03,F
626
01BD:  BSF    03.5
648
01C6:  BSF    03.5
627
01BE:  BCF    1F.4
649
01C7:  BCF    1F.4
628
01BF:  BCF    1F.5
650
01C8:  BCF    1F.5
629
01C0:  MOVF   1B,W
651
01C9:  MOVF   1B,W
630
01C1:  ANDLW  80
652
01CA:  ANDLW  80
631
01C2:  MOVWF  1B
653
01CB:  MOVWF  1B
632
01C3:  MOVLW  07
654
01CC:  MOVLW  07
633
01C4:  MOVWF  1C
655
01CD:  MOVWF  1C
634
....................    int8 n; 
656
....................    int8 n; 
635
....................    int8 perioda; 
657
....................    int8 perioda; 
636
....................    int8 razeni; 
658
....................    int8 razeni; 
637
....................    int8 uclanku; 
659
....................    int8 uclanku; 
-
 
660
....................    int16 ble; 
638
....................  
661
....................  
639
....................    setup_timer_0(RTCC_INTERNAL);setup_wdt(WDT_1152MS); 
662
....................    setup_timer_0(RTCC_INTERNAL);setup_wdt(WDT_1152MS); 
640
*
663
*
641
01E2:  BSF    03.5
664
01EB:  BSF    03.5
642
01E3:  MOVF   01,W
665
01EC:  MOVF   01,W
643
01E4:  ANDLW  C0
666
01ED:  ANDLW  C0
644
01E5:  MOVWF  01
667
01EE:  MOVWF  01
645
01E6:  MOVLW  0E
668
01EF:  MOVLW  0E
646
01E7:  MOVWF  77
669
01F0:  MOVWF  77
647
01E8:  MOVLW  07
670
01F1:  MOVLW  07
648
01E9:  BCF    03.5
671
01F2:  BCF    03.5
649
01EA:  CLRF   01
672
01F3:  CLRF   01
650
01EB:  MOVLW  81
673
01F4:  MOVLW  81
651
01EC:  MOVWF  04
674
01F5:  MOVWF  04
652
01ED:  MOVF   00,W
675
01F6:  MOVF   00,W
653
01EE:  ANDLW  F0
676
01F7:  ANDLW  F0
654
01EF:  IORLW  07
677
01F8:  IORLW  07
655
01F0:  MOVWF  00
678
01F9:  MOVWF  00
656
01F1:  CLRWDT
679
01FA:  CLRWDT
657
01F2:  MOVF   00,W
680
01FB:  MOVF   00,W
658
01F3:  ANDLW  F7
681
01FC:  ANDLW  F7
659
01F4:  BTFSC  77.3
682
01FD:  BTFSC  77.3
660
01F5:  ANDLW  F0
683
01FE:  ANDLW  F0
661
01F6:  IORWF  77,W
684
01FF:  IORWF  77,W
662
01F7:  MOVWF  00
685
0200:  MOVWF  00
663
....................    setup_timer_1(T1_DISABLED); 
686
....................    setup_timer_1(T1_DISABLED); 
664
01F8:  CLRF   10
687
0201:  CLRF   10
665
....................    setup_adc_ports(ADC_CLOCK_INTERNAL|sAN0|sAN1|sAN4|VSS_VDD); 
688
....................    setup_adc_ports(ADC_CLOCK_INTERNAL|sAN0|sAN1|sAN4|VSS_VDD); 
666
01F9:  BSF    03.5
689
0202:  BSF    03.5
667
01FA:  BCF    1F.4
690
0203:  BCF    1F.4
668
01FB:  BCF    1F.5
691
0204:  BCF    1F.5
669
01FC:  MOVF   1B,W
692
0205:  MOVF   1B,W
670
01FD:  ANDLW  80
693
0206:  ANDLW  80
671
01FE:  IORLW  D3
694
0207:  IORLW  D3
672
01FF:  MOVWF  1B
695
0208:  MOVWF  1B
673
....................    setup_adc(ADC_CLOCK_INTERNAL); 
696
....................    setup_adc(ADC_CLOCK_INTERNAL); 
674
0200:  BCF    1F.6
697
0209:  BCF    1F.6
675
0201:  BCF    03.5
698
020A:  BCF    03.5
676
0202:  BSF    1F.6
699
020B:  BSF    1F.6
677
0203:  BSF    1F.7
700
020C:  BSF    1F.7
678
0204:  BSF    03.5
701
020D:  BSF    03.5
679
0205:  BCF    1F.7
702
020E:  BCF    1F.7
680
0206:  BCF    03.5
703
020F:  BCF    03.5
681
0207:  BSF    1F.0
704
0210:  BSF    1F.0
682
....................    setup_spi(FALSE); 
705
....................    setup_spi(FALSE); 
683
0208:  BCF    14.5
706
0211:  BCF    14.5
684
0209:  BSF    03.5
707
0212:  BSF    03.5
685
020A:  BCF    06.2
708
0213:  BCF    06.2
686
020B:  BSF    06.1
709
0214:  BSF    06.1
687
020C:  BCF    06.4
710
0215:  BCF    06.4
688
020D:  MOVLW  00
711
0216:  MOVLW  00
689
020E:  BCF    03.5
712
0217:  BCF    03.5
690
020F:  MOVWF  14
713
0218:  MOVWF  14
691
0210:  BSF    03.5
714
0219:  BSF    03.5
692
0211:  MOVWF  14
715
021A:  MOVWF  14
693
....................    setup_comparator(NC_NC_NC_NC); 
716
....................    setup_comparator(NC_NC_NC_NC); 
694
0212:  MOVLW  07
717
021B:  MOVLW  07
695
0213:  MOVWF  1C
718
021C:  MOVWF  1C
696
0214:  MOVF   05,W
719
021D:  MOVF   05,W
697
0215:  CLRWDT
720
021E:  CLRWDT
698
0216:  MOVLW  02
721
021F:  MOVLW  02
699
0217:  MOVWF  77
722
0220:  MOVWF  77
700
0218:  DECFSZ 77,F
723
0221:  DECFSZ 77,F
701
0219:  GOTO   218
724
0222:  GOTO   221
702
021A:  NOP
725
0223:  NOP
703
021B:  MOVF   1C,W
726
0224:  MOVF   1C,W
704
021C:  BCF    03.5
727
0225:  BCF    03.5
705
021D:  BCF    0D.6
728
0226:  BCF    0D.6
706
....................    setup_vref(FALSE); 
729
....................    setup_vref(FALSE); 
707
021E:  BSF    03.5
730
0227:  BSF    03.5
708
021F:  CLRF   1D
731
0228:  CLRF   1D
709
....................  
732
....................  
710
....................    output_low(MENIC);      // Vsechno zastav 
733
....................    output_low(MENIC);      // Vsechno zastav 
711
0220:  BCF    06.3
734
0229:  BCF    06.3
712
0221:  BCF    03.5
735
022A:  BCF    03.5
713
0222:  BCF    06.3
736
022B:  BCF    06.3
714
....................    output_low(MOTOR); 
737
....................    output_low(MOTOR); 
715
0223:  BSF    03.5
738
022C:  BSF    03.5
716
0224:  BCF    06.2
739
022D:  BCF    06.2
717
0225:  BCF    03.5
740
022E:  BCF    03.5
718
0226:  BCF    06.2
741
022F:  BCF    06.2
719
....................    output_low(REFPWR); 
742
....................    output_low(REFPWR); 
720
0227:  BSF    03.5
743
0230:  BSF    03.5
721
0228:  BCF    06.1
744
0231:  BCF    06.1
722
0229:  BCF    03.5
745
0232:  BCF    03.5
723
022A:  BCF    06.1
746
0233:  BCF    06.1
724
....................    output_high(LED); 
747
....................    output_high(LED); 
725
022B:  BSF    03.5
748
0234:  BSF    03.5
726
022C:  BCF    05.7
749
0235:  BCF    05.7
727
022D:  BCF    03.5
750
0236:  BCF    03.5
728
022E:  BSF    05.7
751
0237:  BSF    05.7
729
....................    output_high(PIEZO); 
752
....................    output_high(PIEZO); 
730
022F:  BSF    03.5
753
0238:  BSF    03.5
731
0230:  BCF    05.6
754
0239:  BCF    05.6
732
0231:  BCF    03.5
755
023A:  BCF    03.5
733
0232:  BSF    05.6
756
023B:  BSF    05.6
734
....................  
757
....................  
735
....................    set_adc_channel(NAPETI);     // Vyber AD kanal pro pomerne mereni napeti 
758
....................    set_adc_channel(NAPETI);     // Vyber AD kanal pro pomerne mereni napeti 
736
0233:  MOVLW  20
759
023C:  MOVLW  20
737
0234:  MOVWF  78
760
023D:  MOVWF  78
738
0235:  MOVF   1F,W
761
023E:  MOVF   1F,W
739
0236:  ANDLW  C7
762
023F:  ANDLW  C7
740
0237:  IORWF  78,W
763
0240:  IORWF  78,W
741
0238:  MOVWF  1F
764
0241:  MOVWF  1F
742
....................    set_pwm1_duty(0);       // Spust PWM, ale zatim s trvalou 0 na vystupu 
765
....................    set_pwm1_duty(0);       // Spust PWM, ale zatim s trvalou 0 na vystupu 
743
0239:  CLRF   15
766
0242:  CLRF   15
744
....................    setup_ccp1(CCP_PWM); 
767
....................    setup_ccp1(CCP_PWM); 
745
023A:  BSF    03.5
768
0243:  BSF    03.5
746
023B:  BCF    06.3
769
0244:  BCF    06.3
747
023C:  BCF    03.5
770
0245:  BCF    03.5
748
023D:  BCF    06.3
771
0246:  BCF    06.3
749
023E:  MOVLW  0C
772
0247:  MOVLW  0C
750
023F:  MOVWF  17
773
0248:  MOVWF  17
751
....................    setup_timer_2(T2_DIV_BY_1,100,1);  // perioda 
774
....................    setup_timer_2(T2_DIV_BY_1,100,1);  // perioda 
752
0240:  MOVLW  00
775
0249:  MOVLW  00
753
0241:  MOVWF  78
776
024A:  MOVWF  78
754
0242:  IORLW  04
777
024B:  IORLW  04
755
0243:  MOVWF  12
778
024C:  MOVWF  12
756
0244:  MOVLW  64
779
024D:  MOVLW  64
757
0245:  BSF    03.5
780
024E:  BSF    03.5
758
0246:  MOVWF  12
781
024F:  MOVWF  12
759
....................  
782
....................  
760
....................    setup_oscillator(OSC_4MHZ|OSC_INTRC);  // rozjed PIC (zvysi se odber) 
783
....................    setup_oscillator(OSC_4MHZ|OSC_INTRC);  // rozjed PIC (zvysi se odber) 
761
0247:  MOVLW  62
784
0250:  MOVLW  62
762
0248:  MOVWF  0F
785
0251:  MOVWF  0F
763
....................  
786
....................  
764
.................... // jsme v depu? 
787
.................... // jsme v depu? 
765
....................    set_pwm1_duty(DUTY1);          // PWM pro zatizeni clanku pri malem osvetleni 
788
....................    set_pwm1_duty(DUTY1);          // PWM pro zatizeni clanku pri malem osvetleni 
766
0249:  MOVLW  02
789
0252:  MOVLW  02
767
024A:  BCF    03.5
790
0253:  BCF    03.5
768
024B:  MOVWF  15
791
0254:  MOVWF  15
769
....................    n=0; 
792
....................    n=0; 
770
024C:  CLRF   6A
793
0255:  CLRF   6A
771
....................    do 
794
....................    do 
772
....................    { 
795
....................    { 
773
....................       output_low(REFPWR);  // Vypni napajeni napetove reference, aby se setrilo 
796
....................       output_low(REFPWR);  // Vypni napajeni napetove reference, aby se setrilo 
774
024D:  BSF    03.5
797
0256:  BSF    03.5
775
024E:  BCF    06.1
798
0257:  BCF    06.1
776
024F:  BCF    03.5
799
0258:  BCF    03.5
777
0250:  BCF    06.1
800
0259:  BCF    06.1
778
....................       delay_ms(100); 
801
....................       delay_ms(100); 
779
0251:  MOVLW  64
802
025A:  MOVLW  64
780
0252:  MOVWF  6F
803
025B:  MOVWF  71
781
0253:  CALL   048
804
025C:  CALL   03C
782
....................       if (4==n++) {cvak(); n=0;};   // Kazdy 4. pruchod cvakni 
805
....................       if (4==n++) {cvak(); n=0;};   // Kazdy 4. pruchod cvakni 
783
0254:  MOVF   6A,W
806
025D:  MOVF   6A,W
784
0255:  INCF   6A,F
807
025E:  INCF   6A,F
785
0256:  SUBLW  04
808
025F:  SUBLW  04
786
0257:  BTFSS  03.2
809
0260:  BTFSS  03.2
787
0258:  GOTO   25B
810
0261:  GOTO   264
788
0259:  GOTO   05E
811
0262:  GOTO   052
789
025A:  CLRF   6A
812
0263:  CLRF   6A
790
....................       output_high(REFPWR);          // Zapni napajeni napetove reference 
813
....................       output_high(REFPWR);          // Zapni napajeni napetove reference 
791
025B:  BSF    03.5
814
0264:  BSF    03.5
792
025C:  BCF    06.1
815
0265:  BCF    06.1
793
025D:  BCF    03.5
816
0266:  BCF    03.5
794
025E:  BSF    06.1
817
0267:  BSF    06.1
795
....................       delay_ms(1);                  // Pockej na ustaleni napeti 
818
....................       delay_ms(1);                  // Pockej na ustaleni napeti 
796
025F:  MOVLW  01
819
0268:  MOVLW  01
797
0260:  MOVWF  6F
820
0269:  MOVWF  71
798
0261:  CALL   048
821
026A:  CALL   03C
799
....................    } while (read_adc()>REFSTART);   // Odkryl starter clanky? 
822
....................    } while (read_adc()>REFSTART);   // Odkryl starter clanky? 
800
0262:  BSF    1F.2
823
026B:  BSF    1F.2
801
0263:  BTFSC  1F.2
824
026C:  BTFSC  1F.2
802
0264:  GOTO   263
825
026D:  GOTO   26C
803
0265:  MOVF   1E,W
826
026E:  MOVF   1E,W
804
0266:  SUBLW  5F
827
026F:  SUBLW  5F
805
0267:  BTFSS  03.0
828
0270:  BTFSS  03.0
806
0268:  GOTO   24D
829
0271:  GOTO   256
807
....................    output_low(REFPWR);     // Vypni napajeni napetove reference, aby se setrilo 
830
....................    output_low(REFPWR);     // Vypni napajeni napetove reference, aby se setrilo 
808
0269:  BSF    03.5
831
0272:  BSF    03.5
809
026A:  BCF    06.1
832
0273:  BCF    06.1
810
026B:  BCF    03.5
833
0274:  BCF    03.5
811
026C:  BCF    06.1
834
0275:  BCF    06.1
812
....................  
835
....................  
813
.................... //   port_b_pullups(TRUE);            // Zapni pullupy, aby slo cist DIPswitch 
836
.................... //   port_b_pullups(TRUE);            // Zapni pullupy, aby slo cist DIPswitch 
814
.................... //   do 
837
.................... //   do 
815
.................... //   { 
838
.................... //   { 
816
....................       // Precti trimry 
839
....................       // Precti trimry 
817
....................       set_adc_channel(PWM);         // Zjisteni nastaveni PWM 
840
....................       set_adc_channel(PWM);         // Zjisteni nastaveni PWM 
818
026D:  MOVLW  00
841
0276:  MOVLW  00
819
026E:  MOVWF  78
842
0277:  MOVWF  78
820
026F:  MOVF   1F,W
843
0278:  MOVF   1F,W
821
0270:  ANDLW  C7
844
0279:  ANDLW  C7
822
0271:  IORWF  78,W
845
027A:  IORWF  78,W
823
0272:  MOVWF  1F
846
027B:  MOVWF  1F
824
....................       delay_us(100);                // Pockej na prepnuti kanalu A/D prevodniku 
847
....................       delay_us(100);                // Pockej na prepnuti kanalu A/D prevodniku 
825
0273:  CLRWDT
848
027C:  CLRWDT
826
0274:  MOVLW  1F
849
027D:  MOVLW  1F
827
0275:  MOVWF  77
-
 
828
0276:  DECFSZ 77,F
-
 
829
0277:  GOTO   276
-
 
830
0278:  NOP
-
 
831
0279:  NOP
-
 
832
....................       perioda=(read_adc()>>1)+40;   // rozsah: 40 az 167 
-
 
833
027A:  BSF    1F.2
-
 
834
027B:  BTFSC  1F.2
-
 
835
027C:  GOTO   27B
-
 
836
027D:  MOVF   1E,W
-
 
837
027E:  MOVWF  77
850
027E:  MOVWF  77
-
 
851
027F:  DECFSZ 77,F
-
 
852
0280:  GOTO   27F
-
 
853
0281:  NOP
-
 
854
0282:  NOP
-
 
855
....................       perioda=(read_adc()>>2)+40;   // rozsah: 40 az 103 
838
027F:  BCF    03.0
856
0283:  BSF    1F.2
-
 
857
0284:  BTFSC  1F.2
-
 
858
0285:  GOTO   284
-
 
859
0286:  MOVF   1E,W
-
 
860
0287:  MOVWF  77
-
 
861
0288:  RRF    77,F
839
0280:  RRF    77,F
862
0289:  RRF    77,F
-
 
863
028A:  MOVLW  3F
-
 
864
028B:  ANDWF  77,F
840
0281:  MOVF   77,W
865
028C:  MOVF   77,W
841
0282:  ADDLW  28
866
028D:  ADDLW  28
842
0283:  MOVWF  6B
867
028E:  MOVWF  6B
843
....................  
868
....................  
844
....................       set_adc_channel(ROZJEZD);     // Zjisteni nastaveni rozjezdu 
869
....................       set_adc_channel(ROZJEZD);     // Zjisteni nastaveni rozjezdu 
845
0284:  MOVLW  08
870
028F:  MOVLW  08
846
0285:  MOVWF  78
871
0290:  MOVWF  78
847
0286:  MOVF   1F,W
872
0291:  MOVF   1F,W
848
0287:  ANDLW  C7
873
0292:  ANDLW  C7
849
0288:  IORWF  78,W
874
0293:  IORWF  78,W
850
0289:  MOVWF  1F
875
0294:  MOVWF  1F
851
....................       delay_us(100);                // Pockej na prepnuti kanalu A/D prevodniku 
876
....................       delay_us(100);                // Pockej na prepnuti kanalu A/D prevodniku 
852
028A:  CLRWDT
877
0295:  CLRWDT
853
028B:  MOVLW  1F
878
0296:  MOVLW  1F
854
028C:  MOVWF  77
879
0297:  MOVWF  77
855
028D:  DECFSZ 77,F
880
0298:  DECFSZ 77,F
856
028E:  GOTO   28D
881
0299:  GOTO   298
857
028F:  NOP
882
029A:  NOP
858
0290:  NOP
883
029B:  NOP
859
....................       razeni=read_adc()>>1;         // rozsah: 0 az 127 
884
....................       razeni=read_adc()>>3;         // rozsah: 0 az 31 
860
0291:  BSF    1F.2
885
029C:  BSF    1F.2
861
0292:  BTFSC  1F.2
886
029D:  BTFSC  1F.2
862
0293:  GOTO   292
887
029E:  GOTO   29D
863
0294:  BCF    03.0
888
029F:  RRF    1E,W
-
 
889
02A0:  MOVWF  6C
-
 
890
02A1:  RRF    6C,F
864
0295:  RRF    1E,W
891
02A2:  RRF    6C,F
865
0296:  MOVWF  6C
892
02A3:  MOVLW  1F
-
 
893
02A4:  ANDWF  6C,F
866
....................  
894
....................  
867
....................       // Rozjeti menice 
895
....................       // Rozjeti menice 
868
....................       set_pwm1_duty(0);    // Zastav PWM, aby slo nastavit jinou frekvenci 
896
....................       set_pwm1_duty(0);    // Zastav PWM, aby slo nastavit jinou frekvenci 
869
0297:  CLRF   15
897
02A5:  CLRF   15
870
....................       setup_timer_2(T2_DIV_BY_1,perioda,1);    // perioda 
898
....................       setup_timer_2(T2_DIV_BY_1,perioda,1);    // perioda 
871
0298:  MOVLW  00
899
02A6:  MOVLW  00
872
0299:  MOVWF  78
900
02A7:  MOVWF  78
873
029A:  IORLW  04
901
02A8:  IORLW  04
874
029B:  MOVWF  12
902
02A9:  MOVWF  12
875
029C:  MOVF   6B,W
903
02AA:  MOVF   6B,W
876
029D:  BSF    03.5
904
02AB:  BSF    03.5
877
029E:  MOVWF  12
905
02AC:  MOVWF  12
878
....................       set_pwm1_duty(DUTY2); // PWM pro zatizeni clanku pri jedne 500W zarovce 
906
....................       set_pwm1_duty(DUTY2); // PWM pro zatizeni clanku pri jedne 500W zarovce 
879
029F:  MOVLW  13
907
02AD:  MOVLW  13
880
02A0:  BCF    03.5
908
02AE:  BCF    03.5
881
02A1:  MOVWF  15
909
02AF:  MOVWF  15
882
....................  
910
....................  
883
....................       pip();                  // potvrzeni odstartovani / servisni mod 
911
....................       pip();                  // potvrzeni odstartovani / servisni mod 
884
02A2:  GOTO   06B
912
02B0:  GOTO   05F
885
....................       delay_ms(500); 
913
....................       delay_ms(500); 
886
02A3:  MOVLW  02
914
02B1:  MOVLW  02
887
02A4:  MOVWF  6E
915
02B2:  MOVWF  70
888
02A5:  MOVLW  FA
916
02B3:  MOVLW  FA
889
02A6:  MOVWF  6F
917
02B4:  MOVWF  71
890
02A7:  CALL   048
918
02B5:  CALL   03C
891
02A8:  DECFSZ 6E,F
919
02B6:  DECFSZ 70,F
892
02A9:  GOTO   2A5
920
02B7:  GOTO   2B3
893
....................  
921
....................  
894
.................... //   } while (input(SW1));      // Je zapnut servisni mod? SW1(OFF)=ANO 
922
.................... //   } while (input(SW1));      // Je zapnut servisni mod? SW1(OFF)=ANO 
895
.................... //   port_b_pullups(FALSE);     // Vypni pullupy, aby se setrilo energii 
923
.................... //   port_b_pullups(FALSE);     // Vypni pullupy, aby se setrilo energii 
896
....................  
924
....................  
897
.................... // Regulace nabíjení 
925
....................    // zmereni napeti na clancich 
898
....................    output_high(REFPWR);          // Prepni AD na mereni napeti clanku 
926
....................    output_high(REFPWR);          // Prepni AD na mereni napeti clanku 
899
02AA:  BSF    03.5
927
02B8:  BSF    03.5
900
02AB:  BCF    06.1
928
02B9:  BCF    06.1
901
02AC:  BCF    03.5
929
02BA:  BCF    03.5
902
02AD:  BSF    06.1
930
02BB:  BSF    06.1
903
....................    set_adc_channel(NAPETI);      // Prepni Zmer napeti clanku 
931
....................    set_adc_channel(NAPETI);      // Prepni Zmer napeti clanku 
904
02AE:  MOVLW  20
932
02BC:  MOVLW  20
905
02AF:  MOVWF  78
933
02BD:  MOVWF  78
906
02B0:  MOVF   1F,W
934
02BE:  MOVF   1F,W
907
02B1:  ANDLW  C7
935
02BF:  ANDLW  C7
908
02B2:  IORWF  78,W
936
02C0:  IORWF  78,W
909
02B3:  MOVWF  1F
937
02C1:  MOVWF  1F
910
....................    delay_us(50);                // Pockej na prepnuti kanalu A/D prevodniku 
938
....................    delay_us(50);                // Pockej na prepnuti kanalu A/D prevodniku 
911
02B4:  CLRWDT
939
02C2:  CLRWDT
912
02B5:  MOVLW  0F
940
02C3:  MOVLW  0F
913
02B6:  MOVWF  77
941
02C4:  MOVWF  77
914
02B7:  DECFSZ 77,F
942
02C5:  DECFSZ 77,F
915
02B8:  GOTO   2B7
943
02C6:  GOTO   2C5
916
02B9:  NOP
944
02C7:  NOP
917
....................    for(n=1;n<=10;n++) 
-
 
918
02BA:  MOVLW  01
-
 
919
02BB:  MOVWF  6A
-
 
920
02BC:  MOVF   6A,W
-
 
921
02BD:  SUBLW  0A
-
 
922
02BE:  BTFSS  03.0
-
 
923
02BF:  GOTO   2DC
-
 
924
....................    { 
-
 
925
....................       // Zmer napeti (aktualni zatizeni clanku) 
-
 
926
....................       uclanku=read_adc(); 
945
....................    uclanku=read_adc(); 
927
02C0:  BSF    1F.2
946
02C8:  BSF    1F.2
928
02C1:  BTFSC  1F.2
947
02C9:  BTFSC  1F.2
929
02C2:  GOTO   2C1
948
02CA:  GOTO   2C9
930
02C3:  MOVF   1E,W
949
02CB:  MOVF   1E,W
931
02C4:  MOVWF  6D
950
02CC:  MOVWF  6D
932
....................       // Uprav parametry menice 
951
....................    output_low(REFPWR);     // odpoj odpor pro mereni napeti 
933
....................       if (uclanku>105) 
-
 
934
02C5:  MOVF   6D,W
-
 
935
02C6:  SUBLW  69
-
 
936
02C7:  BTFSC  03.0
952
02CD:  BSF    03.5
937
02C8:  GOTO   2CB
-
 
938
....................       { 
-
 
939
....................          perioda++; 
-
 
940
02C9:  INCF   6B,F
-
 
941
....................       } 
-
 
942
....................       else 
-
 
943
02CA:  GOTO   2CC
-
 
944
....................       { 
-
 
945
....................          perioda--; 
-
 
946
02CB:  DECF   6B,F
953
02CE:  BCF    06.1
947
....................       } 
-
 
948
....................       set_pwm1_duty(0);    // Zastav PWM, aby slo nastavit jinou frekvenci 
-
 
949
02CC:  CLRF   15
-
 
950
....................       setup_timer_2(T2_DIV_BY_1,perioda,1);    // perioda 
-
 
951
02CD:  MOVLW  00
-
 
952
02CE:  MOVWF  78
-
 
953
02CF:  IORLW  04
-
 
954
02D0:  MOVWF  12
-
 
955
02D1:  MOVF   6B,W
-
 
956
02D2:  BSF    03.5
954
02CF:  BCF    03.5
957
02D3:  MOVWF  12
-
 
958
....................       set_pwm1_duty(DUTY2); // PWM pro zatizeni clanku pri jedne 500W zarovce 
-
 
959
02D4:  MOVLW  13
-
 
960
02D5:  BCF    03.5
955
02D0:  BCF    06.1
961
02D6:  MOVWF  15
-
 
962
....................       delay_ms(100); 
-
 
963
02D7:  MOVLW  64
-
 
964
02D8:  MOVWF  6F
-
 
965
02D9:  CALL   048
-
 
966
....................    } 
956
....................  
967
02DA:  INCF   6A,F
-
 
968
02DB:  GOTO   2BC
-
 
969
....................    output_low(REFPWR); 
-
 
970
02DC:  BSF    03.5
-
 
971
02DD:  BCF    06.1
-
 
972
02DE:  BCF    03.5
-
 
973
02DF:  BCF    06.1
-
 
974
....................    // posli telemetrii 
957
....................    // posli telemetrii 
975
....................    sprintf(AXstring,"p=%u r=%u u=%u", perioda, razeni, uclanku);  // Convert DATA to String. 
958
....................    sprintf(AXstring,"p=%u r=%u u=%u", perioda, razeni, uclanku);  // Convert DATA to String. 
976
*
959
*
977
01E1:  CLRF   69
960
01EA:  CLRF   69
978
*
961
*
979
02E0:  MOVLW  40
962
02D1:  MOVLW  40
980
02E1:  MOVWF  69
963
02D2:  MOVWF  69
981
02E2:  MOVLW  70
964
02D3:  MOVLW  70
982
02E3:  MOVWF  70
965
02D4:  MOVWF  72
983
02E4:  CALL   095
966
02D5:  CALL   08B
984
02E5:  MOVLW  3D
967
02D6:  MOVLW  3D
985
02E6:  MOVWF  70
968
02D7:  MOVWF  72
986
02E7:  CALL   095
969
02D8:  CALL   08B
987
02E8:  MOVF   6B,W
970
02D9:  MOVF   6B,W
988
02E9:  MOVWF  6E
971
02DA:  MOVWF  70
989
02EA:  MOVLW  1B
972
02DB:  MOVLW  1B
990
02EB:  MOVWF  6F
973
02DC:  MOVWF  71
991
02EC:  CALL   0B2
974
02DD:  CALL   0A8
992
02ED:  MOVLW  20
975
02DE:  MOVLW  20
993
02EE:  MOVWF  70
976
02DF:  MOVWF  72
994
02EF:  CALL   095
977
02E0:  CALL   08B
995
02F0:  MOVLW  72
978
02E1:  MOVLW  72
996
02F1:  MOVWF  70
979
02E2:  MOVWF  72
997
02F2:  CALL   095
980
02E3:  CALL   08B
998
02F3:  MOVLW  3D
981
02E4:  MOVLW  3D
999
02F4:  MOVWF  70
982
02E5:  MOVWF  72
1000
02F5:  CALL   095
983
02E6:  CALL   08B
1001
02F6:  MOVF   6C,W
984
02E7:  MOVF   6C,W
1002
02F7:  MOVWF  6E
985
02E8:  MOVWF  70
1003
02F8:  MOVLW  1B
986
02E9:  MOVLW  1B
1004
02F9:  MOVWF  6F
987
02EA:  MOVWF  71
1005
02FA:  CALL   0B2
988
02EB:  CALL   0A8
1006
02FB:  MOVLW  20
989
02EC:  MOVLW  20
1007
02FC:  MOVWF  70
990
02ED:  MOVWF  72
1008
02FD:  CALL   095
991
02EE:  CALL   08B
1009
02FE:  MOVLW  75
992
02EF:  MOVLW  75
1010
02FF:  MOVWF  70
993
02F0:  MOVWF  72
1011
0300:  CALL   095
994
02F1:  CALL   08B
1012
0301:  MOVLW  3D
995
02F2:  MOVLW  3D
1013
0302:  MOVWF  70
996
02F3:  MOVWF  72
1014
0303:  CALL   095
997
02F4:  CALL   08B
1015
0304:  MOVF   6D,W
998
02F5:  MOVF   6D,W
1016
0305:  MOVWF  6E
999
02F6:  MOVWF  70
1017
0306:  MOVLW  1B
1000
02F7:  MOVLW  1B
1018
0307:  MOVWF  6F
1001
02F8:  MOVWF  71
1019
0308:  CALL   0B2
1002
02F9:  CALL   0A8
1020
....................    SendPacket(&AXstring[0]); 
1003
....................    SendPacket(&AXstring[0]); 
1021
0309:  MOVLW  40
1004
02FA:  MOVLW  40
1022
030A:  MOVWF  6E
1005
02FB:  MOVWF  70
1023
030B:  GOTO   177
1006
02FC:  GOTO   16D
1024
....................  
1007
....................  
1025
....................    delay_ms(13000);           // Pockame 14s 
1008
....................    delay_ms(14000);           // Pockame do 14.5s 
1026
030C:  MOVLW  34
1009
02FD:  MOVLW  38
1027
030D:  MOVWF  6E
1010
02FE:  MOVWF  70
1028
030E:  MOVLW  FA
1011
02FF:  MOVLW  FA
1029
030F:  MOVWF  6F
1012
0300:  MOVWF  71
1030
0310:  CALL   048
1013
0301:  CALL   03C
1031
0311:  DECFSZ 6E,F
1014
0302:  DECFSZ 70,F
1032
0312:  GOTO   30E
1015
0303:  GOTO   2FF
1033
....................  
1016
....................  
1034
.................... // rozjezd 
1017
....................    // rozjezd 
1035
....................    SSPSTAT = 0;                  // inicializace SPI jednotky 
1018
....................    for(ble=1;ble<=1000;ble++) 
-
 
1019
0304:  CLRF   6F
1036
0313:  BSF    03.5
1020
0305:  MOVLW  01
1037
0314:  CLRF   14
1021
0306:  MOVWF  6E
1038
....................    SSPCON1 = 0x22;               // SPI OSC/64 
1022
0307:  MOVF   6F,W
1039
0315:  MOVLW  22
1023
0308:  SUBLW  03
1040
0316:  BCF    03.5
1024
0309:  BTFSS  03.0
1041
0317:  MOVWF  14
1025
030A:  GOTO   333
1042
....................    MotorPattern=0x02;            // prvni data pro vyslani 
1026
030B:  BTFSS  03.2
1043
0318:  MOVLW  02
1027
030C:  GOTO   311
1044
0319:  MOVWF  68
1028
030D:  MOVF   6E,W
1045
....................    SSPBUF=MotorPattern; 
1029
030E:  SUBLW  E8
1046
031A:  MOVF   68,W
1030
030F:  BTFSS  03.0
1047
031B:  MOVWF  13
1031
0310:  GOTO   333
-
 
1032
....................    {    
1048
....................    enable_interrupts(global); 
1033
....................       for(n=0;n<=razeni;n++) 
-
 
1034
0311:  CLRF   6A
1049
031C:  MOVLW  C0
1035
0312:  MOVF   6A,W
1050
031D:  IORWF  0B,F
1036
0313:  SUBWF  6C,W
1051
....................    enable_interrupts(INT_SSP);   // az budou vyslana, prijde interrupt od SSP 
-
 
1052
031E:  BSF    03.5
1037
0314:  BTFSS  03.0
1053
031F:  BSF    0C.3
1038
0315:  GOTO   32F
1054
....................  
1039
....................       { 
1055
....................    for(n=0; n<=7; n++)     // razeni osmi rychlostnich stupnu 
1040
....................          output_high(MOTOR);               
-
 
1041
0316:  BSF    03.5
-
 
1042
0317:  BCF    06.2
1056
0320:  BCF    03.5
1043
0318:  BCF    03.5
1057
0321:  CLRF   6A
1044
0319:  BSF    06.2
-
 
1045
....................          delay_us(ble);    
1058
0322:  MOVF   6A,W
1046
031A:  MOVF   6E,W
-
 
1047
031B:  MOVWF  72
1059
0323:  SUBLW  07
1048
031C:  CALL   1B0
-
 
1049
....................          output_low(MOTOR);              
1060
0324:  BTFSS  03.0
1050
031D:  BSF    03.5
-
 
1051
031E:  BCF    06.2
1061
0325:  GOTO   32F
1052
031F:  BCF    03.5
1062
....................    { 
1053
0320:  BCF    06.2
1063
....................       MotorPattern=Pattern[n]; 
1054
....................          delay_us(1000-ble);    
1064
0326:  MOVF   6A,W
1055
0321:  MOVF   6E,W
1065
0327:  CALL   037
1056
0322:  SUBLW  E8
1066
0328:  MOVWF  78
1057
0323:  MOVWF  70
-
 
1058
0324:  MOVLW  03
1067
0329:  MOVWF  68
1059
0325:  MOVWF  71
1068
....................       delay_ms(razeni);             // Pockej na dalsi razeni 
1060
0326:  MOVF   6F,W
-
 
1061
0327:  BTFSS  03.0
-
 
1062
0328:  INCFSZ 6F,W
-
 
1063
0329:  SUBWF  71,F
1069
032A:  MOVF   6C,W
1064
032A:  MOVF   70,W
1070
032B:  MOVWF  6F
1065
032B:  MOVWF  72
1071
032C:  CALL   048
1066
032C:  CALL   1B0
1072
....................    }; 
1067
....................       } 
1073
032D:  INCF   6A,F
1068
032D:  INCF   6A,F
1074
032E:  GOTO   322
1069
032E:  GOTO   312
1075
....................    SSPSTAT = 0; 
1070
....................    } 
1076
032F:  BSF    03.5
1071
032F:  INCF   6E,F
1077
0330:  CLRF   14
-
 
1078
....................    SSPCON1 = 0;                     // SPI stop 
-
 
1079
0331:  BCF    03.5
1072
0330:  BTFSC  03.2
1080
0332:  CLRF   14
1073
0331:  INCF   6F,F
1081
....................    disable_interrupts(INT_SSP);     // zastav preruseni od SSP 
-
 
1082
0333:  BSF    03.5
1074
0332:  GOTO   307
1083
0334:  BCF    0C.3
-
 
1084
....................  
1075
....................  
1085
.................... // jedem co to da 
1076
.................... // jedem co to da 
1086
....................    output_high(MOTOR); 
1077
....................    output_high(MOTOR); 
-
 
1078
0333:  BSF    03.5
1087
0335:  BCF    06.2
1079
0334:  BCF    06.2
1088
0336:  BCF    03.5
1080
0335:  BCF    03.5
1089
0337:  BSF    06.2
1081
0336:  BSF    06.2
1090
....................  
1082
....................  
1091
.................... /* 
-
 
1092
....................    if (TRUE)         // Venkovni jizda? 
-
 
1093
....................    { 
-
 
1094
....................       delay_ms(5000);                  // Venku muzeme jet 5s 
-
 
1095
....................       set_pwm1_duty(0);                // Zastav menic 
-
 
1096
.................... //      output_low(MOTOR);               // Zastav motor 
-
 
1097
....................       while(TRUE) restart_wdt();       // Cekej porad 
-
 
1098
....................    }; 
-
 
1099
....................    delay_ms(3000);                  
-
 
1100
.................... */ 
-
 
1101
....................    delay_ms(1300);                  // Nemeli bysme jet dele nez 1,3s :-) 
1083
....................    delay_ms(1300);                  // Nemeli bysme jet dele nez 1,3s :-) 
1102
0338:  MOVLW  0A
1084
0337:  MOVLW  0A
1103
0339:  MOVWF  6E
1085
0338:  MOVWF  70
1104
033A:  MOVLW  82
1086
0339:  MOVLW  82
1105
033B:  MOVWF  6F
1087
033A:  MOVWF  71
1106
033C:  CALL   048
1088
033B:  CALL   03C
1107
033D:  DECFSZ 6E,F
1089
033C:  DECFSZ 70,F
1108
033E:  GOTO   33A
1090
033D:  GOTO   339
1109
....................    output_low(MOTOR);               // Zastav motor 
1091
....................    output_low(MOTOR);               // Zastav motor 
1110
033F:  BSF    03.5
1092
033E:  BSF    03.5
1111
0340:  BCF    06.2
1093
033F:  BCF    06.2
1112
0341:  BCF    03.5
1094
0340:  BCF    03.5
1113
0342:  BCF    06.2
1095
0341:  BCF    06.2
1114
....................                                     // Menic je stale zapnut a zatezuje clanky 
1096
....................                                     // Menic je stale zapnut a zatezuje clanky 
1115
....................  
1097
....................  
1116
....................    while(TRUE);            // Cekej, dokud se neztrati svetlo, 
1098
....................    while(TRUE);            // Cekej, dokud se neztrati svetlo, 
1117
0343:  GOTO   343
1099
0342:  GOTO   342
1118
....................                            // nebo prijde WatchDog 
1100
....................                            // nebo prijde WatchDog 
1119
....................  
1101
....................  
1120
.................... } 
1102
.................... } 
1121
0344:  SLEEP
1103
0343:  SLEEP
1122
 
1104
 
1123
Configuration Fuses:
1105
Configuration Fuses:
1124
   Word  1: 273C   WDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT DEBUG CCPB3 NOPROTECT INTRC_IO
1106
   Word  1: 2738   NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT DEBUG CCPB3 NOPROTECT INTRC_IO
1125
   Word  2: 3FFC   NOFCMEN NOIESO
1107
   Word  2: 3FFC   NOFCMEN NOIESO