Rev Author Line No. Line
1435 kaklik 1 CCS PCH C Compiler, Version 4.090, 47914 23-I-10 18:55
1431 kaklik 2  
3 Filename: D:\MLAB\Designs\STOPWATCH02A\SW\test\main.lst
4  
1435 kaklik 5 ROM used: 370 bytes (1%)
6 Largest free fragment is 32394
7 RAM used: 25 (1%) at main() level
8 26 (1%) worst case
1431 kaklik 9 Stack: 2 worst case (1 in main + 1 for interrupts)
10  
11 *
1435 kaklik 12 0000: GOTO 00D0
1431 kaklik 13 *
14 0008: MOVWF 05
15 000A: MOVFF FD8,06
16 000E: MOVFF FE0,07
17 0012: MOVLB 0
18 0014: MOVFF FE9,0D
19 0018: MOVFF FEA,08
20 001C: MOVFF FE1,09
21 0020: MOVFF FE2,0A
22 0024: MOVFF FD9,0B
23 0028: MOVFF FDA,0C
24 002C: MOVFF FF3,14
25 0030: MOVFF FF4,15
26 0034: MOVFF FFA,16
27 0038: MOVFF 00,0F
28 003C: MOVFF 01,10
29 0040: MOVFF 02,11
30 0044: MOVFF 03,12
31 0048: MOVFF 04,13
32 004C: BTFSS FF2.5
33 004E: GOTO 0058
34 0052: BTFSC FF2.2
1435 kaklik 35 0054: GOTO 009E
36 0058: MOVFF 0F,00
37 005C: MOVFF 10,01
38 0060: MOVFF 11,02
39 0064: MOVFF 12,03
40 0068: MOVFF 13,04
41 006C: MOVFF 0D,FE9
42 0070: MOVFF 08,FEA
43 0074: BSF 08.7
44 0076: MOVFF 09,FE1
45 007A: MOVFF 0A,FE2
46 007E: MOVFF 0B,FD9
47 0082: MOVFF 0C,FDA
48 0086: MOVFF 14,FF3
49 008A: MOVFF 15,FF4
50 008E: MOVFF 16,FFA
51 0092: MOVF 05,W
52 0094: MOVFF 07,FE0
53 0098: MOVFF 06,FD8
54 009C: RETFIE 0
1431 kaklik 55 .................... #include "D:\MLAB\Designs\STOPWATCH02A\SW\test\main.h"
56 .................... #include <18F4550.h>
57 .................... //////// Standard Header file for the PIC18F4550 device ////////////////
58 .................... #device PIC18F4550
59 .................... #list
60 ....................
61 .................... #device adc=8
62 ....................
63 .................... #FUSES NOWDT //No Watch Dog Timer
64 .................... #FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
65 .................... #FUSES INTRC_IO
66 .................... #FUSES NOPROTECT //Code not protected from reading
67 .................... #FUSES NOBROWNOUT //No brownout reset
68 .................... #FUSES BORV20 //Brownout reset at 2.0V
69 .................... #FUSES NOPUT //No Power Up Timer
70 .................... #FUSES NOCPD //No EE protection
71 .................... #FUSES STVREN //Stack full/underflow will cause reset
72 .................... #FUSES NODEBUG //No Debug mode for ICD
73 .................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
74 .................... #FUSES NOWRT //Program memory not write protected
75 .................... #FUSES NOWRTD //Data EEPROM not write protected
76 .................... #FUSES IESO //Internal External Switch Over mode enabled
77 .................... #FUSES FCMEN //Fail-safe clock monitor enabled
78 .................... #FUSES PBADEN //PORTB pins are configured as analog input channels on RESET
79 .................... #FUSES NOWRTC //configuration not registers write protected
80 .................... #FUSES NOWRTB //Boot block not write protected
81 .................... #FUSES NOEBTR //Memory not protected from table reads
82 .................... #FUSES NOEBTRB //Boot block not protected from table reads
83 .................... #FUSES NOCPB //No Boot Block code protection
84 .................... #FUSES MCLR //Master Clear pin enabled
85 .................... #FUSES LPT1OSC //Timer1 configured for low-power operation
86 .................... #FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
87 .................... #FUSES PLL12 //Divide By 12(48MHz oscillator input)
88 .................... #FUSES CPUDIV4 //System Clock by 4
89 .................... #FUSES USBDIV //USB clock source comes from PLL divide by 2
90 .................... #FUSES NOVREGEN //USB voltage regulator enabled
91 .................... #FUSES NOICPRT //ICPRT enabled
92 ....................
93 .................... #use delay(clock=8000000)
94 *
1435 kaklik 95 00A8: CLRF FEA
96 00AA: MOVLW 19
97 00AC: MOVWF FE9
98 00AE: MOVF FEF,W
99 00B0: BZ 00CC
100 00B2: MOVLW 02
101 00B4: MOVWF 01
102 00B6: CLRF 00
103 00B8: DECFSZ 00,F
104 00BA: BRA 00B8
105 00BC: DECFSZ 01,F
106 00BE: BRA 00B6
107 00C0: MOVLW 97
108 00C2: MOVWF 00
109 00C4: DECFSZ 00,F
110 00C6: BRA 00C4
111 00C8: DECFSZ FEF,F
112 00CA: BRA 00B2
113 00CC: GOTO 015C (RETURN)
1431 kaklik 114 .................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
115 ....................
116 ....................
117 ....................
118 .................... #define LED1 PIN_A1
119 .................... #define LED2 PIN_A2
120 ....................
121 .................... #int_TIMER0
122 .................... void TIMER0_isr(void)
123 .................... {
124 .................... Output_low(LED2);
125 *
1435 kaklik 126 009E: BCF F92.2
127 00A0: BCF F89.2
1431 kaklik 128 .................... }
129 ....................
1435 kaklik 130 .................... /*#int_RB
1431 kaklik 131 .................... void RB_isr(void)
132 .................... {
1435 kaklik 133 .................... output_high(LED2);
134 .................... }*/
1431 kaklik 135 ....................
136 ....................
1435 kaklik 137 00A2: BCF FF2.2
138 00A4: GOTO 0058
1431 kaklik 139 .................... void main()
140 .................... {
141 *
1435 kaklik 142 00D0: CLRF FF8
143 00D2: BCF FD0.7
144 00D4: BSF 08.7
145 00D6: CLRF FEA
146 00D8: CLRF FE9
147 00DA: MOVLW 70
148 00DC: MOVWF FD3
149 00DE: MOVF FD3,W
150 00E0: BCF FB8.3
151 00E2: MOVLW 0C
152 00E4: MOVWF FAF
153 00E6: MOVLW A2
154 00E8: MOVWF FAC
155 00EA: MOVLW 90
156 00EC: MOVWF FAB
157 00EE: MOVF FC1,W
158 00F0: ANDLW C0
159 00F2: IORLW 0F
160 00F4: MOVWF FC1
161 00F6: MOVLW 07
162 00F8: MOVWF FB4
163 .................... unsigned int8 last;
164 ....................
1431 kaklik 165 .................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
1435 kaklik 166 00FA: MOVF FC1,W
167 00FC: ANDLW C0
168 00FE: IORLW 0F
169 0100: MOVWF FC1
1431 kaklik 170 .................... setup_adc(ADC_OFF);
1435 kaklik 171 0102: BCF FC2.0
1431 kaklik 172 .................... setup_psp(PSP_DISABLED);
1435 kaklik 173 0104: BCF FB0.4
1431 kaklik 174 .................... setup_spi(SPI_SS_DISABLED);
1435 kaklik 175 0106: BCF FC6.5
176 0108: BCF F94.7
177 010A: BSF F93.0
178 010C: BCF F93.1
179 010E: MOVLW 01
180 0110: MOVWF FC6
181 0112: MOVLW 00
182 0114: MOVWF FC7
1431 kaklik 183 .................... setup_wdt(WDT_OFF);
1435 kaklik 184 0116: BCF FD1.0
1431 kaklik 185 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_4);
1435 kaklik 186 0118: MOVLW 81
187 011A: MOVWF FD5
1431 kaklik 188 .................... setup_timer_1(T1_DISABLED);
1435 kaklik 189 011C: CLRF FCD
1431 kaklik 190 .................... setup_timer_2(T2_DISABLED,0,1);
1435 kaklik 191 011E: MOVLW 00
192 0120: MOVWF FCA
193 0122: MOVLW 00
194 0124: MOVWF FCB
1431 kaklik 195 .................... setup_timer_3(T3_EXTERNAL|T3_DIV_BY_8);
1435 kaklik 196 0126: MOVLW B7
197 0128: MOVWF FB1
1431 kaklik 198 .................... setup_comparator(NC_NC_NC_NC);
1435 kaklik 199 012A: MOVLW 07
200 012C: MOVWF FB4
201 012E: MOVF F92,W
202 0130: MOVWF F92
203 0132: MOVLW 06
204 0134: MOVWF 00
205 0136: DECFSZ 00,F
206 0138: BRA 0136
207 013A: NOP
208 013C: MOVF FB4,W
209 013E: BCF FA1.6
1431 kaklik 210 .................... setup_vref(FALSE);
1435 kaklik 211 0140: CLRF FB5
1431 kaklik 212 ....................
213 .................... port_b_pullups(TRUE);
1435 kaklik 214 0142: BCF FF1.7
1431 kaklik 215 ....................
216 .................... enable_interrupts(INT_TIMER0);
1435 kaklik 217 0144: BSF FF2.5
218 .................... // enable_interrupts(INT_RB);
1431 kaklik 219 .................... enable_interrupts(GLOBAL);
1435 kaklik 220 0146: MOVLW C0
221 0148: IORWF FF2,F
1431 kaklik 222 ....................
1435 kaklik 223 .................... last=input_b();
224 014A: MOVLW FF
225 014C: MOVWF F93
226 014E: MOVFF F81,18
227 ....................
1431 kaklik 228 .................... while(true)
229 .................... {
230 .................... Output_toggle(LED1);
1435 kaklik 231 0152: BCF F92.1
232 0154: BTG F89.1
1431 kaklik 233 .................... Delay_ms(100);
1435 kaklik 234 0156: MOVLW 64
235 0158: MOVWF 19
236 015A: BRA 00A8
237 .................... if(last!=Input_b()) output_high(LED2);
238 015C: MOVLW FF
239 015E: MOVWF F93
240 0160: MOVF F81,W
241 0162: SUBWF 18,W
242 0164: BZ 016A
243 0166: BCF F92.2
244 0168: BSF F89.2
245 .................... last=input_b();
246 016A: MOVLW FF
247 016C: MOVWF F93
248 016E: MOVFF F81,18
1431 kaklik 249 .................... }
1435 kaklik 250 0172: BRA 0152
1431 kaklik 251 .................... }
1435 kaklik 252 0174: SLEEP
1431 kaklik 253  
254 Configuration Fuses:
255 Word 1: C83F INTRC_IO IESO FCMEN PLL12 CPUDIV4 USBDIV
256 Word 2: 0E19 NOBROWNOUT WDT128 NOWDT BORV20 NOPUT NOVREGEN
257 Word 3: 8700 PBADEN CCP2C1 MCLR LPT1OSC
258 Word 4: 0081 STVREN NODEBUG NOLVP NOXINST NOICPRT
259 Word 5: C00F NOPROTECT NOCPD NOCPB
260 Word 6: E00F NOWRT NOWRTD NOWRTC NOWRTB
261 Word 7: 400F NOEBTR NOEBTRB