/Designs/STOPWATCH02A/SW/test/main.c
9,17 → 9,17
Output_low(LED2);
}
 
#int_RB
/*#int_RB
void RB_isr(void)
{
output_high(LED2);
output_toggle(PIN_B2);
input_b();
}
}*/
 
 
void main()
{
unsigned int8 last;
 
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
32,16 → 32,18
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
set_tris_b(0xFF);
port_b_pullups(TRUE);
 
enable_interrupts(INT_TIMER0);
enable_interrupts(INT_RB);
// enable_interrupts(INT_RB);
enable_interrupts(GLOBAL);
 
last=input_b();
while(true)
{
Output_toggle(LED1);
Delay_ms(100);
if(last!=Input_b()) output_high(LED2);
last=input_b();
}
}
/Designs/STOPWATCH02A/SW/test/main.hex
1,31 → 1,31
:020000040000FA
:0400000077EF00F0A6
:0400000068EF00F0B5
:08000800056ED8CF06F0E0CF31
:1000100007F00001E9CF0DF0EACF08F0E1CF09F0D9
:10002000E2CF0AF0D9CF0BF0DACF0CF0F3CF14F017
:10003000F4CF15F0FACF16F000C00FF001C010F0A9
:1000400002C011F003C012F004C013F0F2AA2CEFAA
:1000500000F0F2B455EF00F0F2A632EF00F0F2B08B
:100060005AEF00F00FC000F010C001F011C002F014
:1000700012C003F013C004F00DC0E9FF08C0EAFF8E
:10008000088E09C0E1FF0AC0E2FF0BC0D9FF0CC017
:10009000DAFF14C0F3FF15C0F4FF16C0FAFF0550D5
:1000A00007C0E0FF06C0D8FF100092948994F29434
:1000B00032EF00F09294898493948A74FF0E936EC9
:1000C000F29032EF00F0EA6A180EE96EEF500DE0A0
:1000D000020E016E006A002EFED7012EFBD7970E8E
:1000E000006E002EFED7EF2EF3D7BCEF00F0F86ABB
:1000F000D09E088EEA6AE96A700ED36ED350B89625
:100100000C0EAF6EA20EAC6E900EAB6EC150C00B5B
:100110000F09C16E070EB46EC150C00B0F09C16E3E
:10012000C290B098C69A949E93809392010EC66E28
:10013000000EC76ED190810ED56ECD6A000ECA6ECC
:10014000000ECB6EB70EB16E070EB46E9250926E6B
:10015000060E006E002EFED70000B450A19CB56ABA
:10016000FF0E936EF19EF28AF286C00EF212929208
:0C0170008972640E186EA7D7FAD703003E
:1000500000F0F2B44FEF00F00FC000F010C001F05C
:1000600011C002F012C003F013C004F00DC0E9FF8C
:1000700008C0EAFF088E09C0E1FF0AC0E2FF0BC01A
:10008000D9FF0CC0DAFF14C0F3FF15C0F4FF16C08F
:10009000FAFF055007C0E0FF06C0D8FF1000929499
:1000A0008994F2942CEF00F0EA6A190EE96EEF5091
:1000B0000DE0020E016E006A002EFED7012EFBD766
:1000C000970E006E002EFED7EF2EF3D7AEEF00F0A6
:1000D000F86AD09E088EEA6AE96A700ED36ED35031
:1000E000B8960C0EAF6EA20EAC6E900EAB6EC150F9
:1000F000C00B0F09C16E070EB46EC150C00B0F09C3
:10010000C16EC290B098C69A949E93809392010E4D
:10011000C66E000EC76ED190810ED56ECD6A000EF0
:10012000CA6E000ECB6EB70EB16E070EB46E925053
:10013000926E060E006E002EFED70000B450A19CF9
:10014000B56AF19EF28AC00EF212FF0E936E81CF55
:1001500018F092928972640E196EA6D7FF0E936EF4
:100160008150185C02E092948984FF0E936E81CFD7
:0601700018F0EFD70300B8
:020000040030CA
:0E0000003FC8190E008781000FC00FE00F40AF
:00000001FF
;PIC18F4550
;CRC=E3C3 CREATED="20-I-10 01:41"
;CRC=9481 CREATED="23-I-10 18:55"
/Designs/STOPWATCH02A/SW/test/main.lst
1,15 → 1,15
CCS PCH C Compiler, Version 4.090, 47914 20-I-10 01:41
CCS PCH C Compiler, Version 4.090, 47914 23-I-10 18:55
 
Filename: D:\MLAB\Designs\STOPWATCH02A\SW\test\main.lst
 
ROM used: 376 bytes (1%)
Largest free fragment is 32388
RAM used: 24 (1%) at main() level
25 (1%) worst case
ROM used: 370 bytes (1%)
Largest free fragment is 32394
RAM used: 25 (1%) at main() level
26 (1%) worst case
Stack: 2 worst case (1 in main + 1 for interrupts)
 
*
0000: GOTO 00EE
0000: GOTO 00D0
*
0008: MOVWF 05
000A: MOVFF FD8,06
32,30 → 32,26
004C: BTFSS FF2.5
004E: GOTO 0058
0052: BTFSC FF2.2
0054: GOTO 00AA
0058: BTFSS FF2.3
005A: GOTO 0064
005E: BTFSC FF2.0
0060: GOTO 00B4
0064: MOVFF 0F,00
0068: MOVFF 10,01
006C: MOVFF 11,02
0070: MOVFF 12,03
0074: MOVFF 13,04
0078: MOVFF 0D,FE9
007C: MOVFF 08,FEA
0080: BSF 08.7
0082: MOVFF 09,FE1
0086: MOVFF 0A,FE2
008A: MOVFF 0B,FD9
008E: MOVFF 0C,FDA
0092: MOVFF 14,FF3
0096: MOVFF 15,FF4
009A: MOVFF 16,FFA
009E: MOVF 05,W
00A0: MOVFF 07,FE0
00A4: MOVFF 06,FD8
00A8: RETFIE 0
0054: GOTO 009E
0058: MOVFF 0F,00
005C: MOVFF 10,01
0060: MOVFF 11,02
0064: MOVFF 12,03
0068: MOVFF 13,04
006C: MOVFF 0D,FE9
0070: MOVFF 08,FEA
0074: BSF 08.7
0076: MOVFF 09,FE1
007A: MOVFF 0A,FE2
007E: MOVFF 0B,FD9
0082: MOVFF 0C,FDA
0086: MOVFF 14,FF3
008A: MOVFF 15,FF4
008E: MOVFF 16,FFA
0092: MOVF 05,W
0094: MOVFF 07,FE0
0098: MOVFF 06,FD8
009C: RETFIE 0
.................... #include "D:\MLAB\Designs\STOPWATCH02A\SW\test\main.h"
.................... #include <18F4550.h>
.................... //////// Standard Header file for the PIC18F4550 device ////////////////
96,25 → 92,25
....................
.................... #use delay(clock=8000000)
*
00C6: CLRF FEA
00C8: MOVLW 18
00CA: MOVWF FE9
00CC: MOVF FEF,W
00CE: BZ 00EA
00D0: MOVLW 02
00D2: MOVWF 01
00D4: CLRF 00
00D6: DECFSZ 00,F
00D8: BRA 00D6
00DA: DECFSZ 01,F
00DC: BRA 00D4
00DE: MOVLW 97
00E0: MOVWF 00
00E2: DECFSZ 00,F
00E4: BRA 00E2
00E6: DECFSZ FEF,F
00E8: BRA 00D0
00EA: GOTO 0178 (RETURN)
00A8: CLRF FEA
00AA: MOVLW 19
00AC: MOVWF FE9
00AE: MOVF FEF,W
00B0: BZ 00CC
00B2: MOVLW 02
00B4: MOVWF 01
00B6: CLRF 00
00B8: DECFSZ 00,F
00BA: BRA 00B8
00BC: DECFSZ 01,F
00BE: BRA 00B6
00C0: MOVLW 97
00C2: MOVWF 00
00C4: DECFSZ 00,F
00C6: BRA 00C4
00C8: DECFSZ FEF,F
00CA: BRA 00B2
00CC: GOTO 015C (RETURN)
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
....................
....................
127,128 → 123,133
.................... {
.................... Output_low(LED2);
*
00AA: BCF F92.2
00AC: BCF F89.2
009E: BCF F92.2
00A0: BCF F89.2
.................... }
....................
00AE: BCF FF2.2
00B0: GOTO 0064
.................... #int_RB
.................... /*#int_RB
.................... void RB_isr(void)
.................... {
.................... output_high(LED2);
00B4: BCF F92.2
00B6: BSF F89.2
.................... output_toggle(PIN_B2);
00B8: BCF F93.2
00BA: BTG F8A.2
.................... input_b();
00BC: MOVLW FF
00BE: MOVWF F93
.................... }
.................... }*/
....................
....................
00C0: BCF FF2.0
00C2: GOTO 0064
00A2: BCF FF2.2
00A4: GOTO 0058
.................... void main()
.................... {
*
00EE: CLRF FF8
00F0: BCF FD0.7
00F2: BSF 08.7
00F4: CLRF FEA
00F6: CLRF FE9
00F8: MOVLW 70
00FA: MOVWF FD3
00FC: MOVF FD3,W
00FE: BCF FB8.3
0100: MOVLW 0C
0102: MOVWF FAF
0104: MOVLW A2
0106: MOVWF FAC
0108: MOVLW 90
010A: MOVWF FAB
010C: MOVF FC1,W
010E: ANDLW C0
0110: IORLW 0F
0112: MOVWF FC1
0114: MOVLW 07
0116: MOVWF FB4
00D0: CLRF FF8
00D2: BCF FD0.7
00D4: BSF 08.7
00D6: CLRF FEA
00D8: CLRF FE9
00DA: MOVLW 70
00DC: MOVWF FD3
00DE: MOVF FD3,W
00E0: BCF FB8.3
00E2: MOVLW 0C
00E4: MOVWF FAF
00E6: MOVLW A2
00E8: MOVWF FAC
00EA: MOVLW 90
00EC: MOVWF FAB
00EE: MOVF FC1,W
00F0: ANDLW C0
00F2: IORLW 0F
00F4: MOVWF FC1
00F6: MOVLW 07
00F8: MOVWF FB4
.................... unsigned int8 last;
....................
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
0118: MOVF FC1,W
011A: ANDLW C0
011C: IORLW 0F
011E: MOVWF FC1
00FA: MOVF FC1,W
00FC: ANDLW C0
00FE: IORLW 0F
0100: MOVWF FC1
.................... setup_adc(ADC_OFF);
0120: BCF FC2.0
0102: BCF FC2.0
.................... setup_psp(PSP_DISABLED);
0122: BCF FB0.4
0104: BCF FB0.4
.................... setup_spi(SPI_SS_DISABLED);
0124: BCF FC6.5
0126: BCF F94.7
0128: BSF F93.0
012A: BCF F93.1
012C: MOVLW 01
012E: MOVWF FC6
0130: MOVLW 00
0132: MOVWF FC7
0106: BCF FC6.5
0108: BCF F94.7
010A: BSF F93.0
010C: BCF F93.1
010E: MOVLW 01
0110: MOVWF FC6
0112: MOVLW 00
0114: MOVWF FC7
.................... setup_wdt(WDT_OFF);
0134: BCF FD1.0
0116: BCF FD1.0
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_4);
0136: MOVLW 81
0138: MOVWF FD5
0118: MOVLW 81
011A: MOVWF FD5
.................... setup_timer_1(T1_DISABLED);
013A: CLRF FCD
011C: CLRF FCD
.................... setup_timer_2(T2_DISABLED,0,1);
013C: MOVLW 00
013E: MOVWF FCA
0140: MOVLW 00
0142: MOVWF FCB
011E: MOVLW 00
0120: MOVWF FCA
0122: MOVLW 00
0124: MOVWF FCB
.................... setup_timer_3(T3_EXTERNAL|T3_DIV_BY_8);
0144: MOVLW B7
0146: MOVWF FB1
0126: MOVLW B7
0128: MOVWF FB1
.................... setup_comparator(NC_NC_NC_NC);
0148: MOVLW 07
014A: MOVWF FB4
014C: MOVF F92,W
014E: MOVWF F92
0150: MOVLW 06
0152: MOVWF 00
0154: DECFSZ 00,F
0156: BRA 0154
0158: NOP
015A: MOVF FB4,W
015C: BCF FA1.6
012A: MOVLW 07
012C: MOVWF FB4
012E: MOVF F92,W
0130: MOVWF F92
0132: MOVLW 06
0134: MOVWF 00
0136: DECFSZ 00,F
0138: BRA 0136
013A: NOP
013C: MOVF FB4,W
013E: BCF FA1.6
.................... setup_vref(FALSE);
015E: CLRF FB5
0140: CLRF FB5
....................
.................... set_tris_b(0xFF);
0160: MOVLW FF
0162: MOVWF F93
.................... port_b_pullups(TRUE);
0164: BCF FF1.7
0142: BCF FF1.7
....................
.................... enable_interrupts(INT_TIMER0);
0166: BSF FF2.5
.................... enable_interrupts(INT_RB);
0168: BSF FF2.3
0144: BSF FF2.5
.................... // enable_interrupts(INT_RB);
.................... enable_interrupts(GLOBAL);
016A: MOVLW C0
016C: IORWF FF2,F
0146: MOVLW C0
0148: IORWF FF2,F
....................
.................... last=input_b();
014A: MOVLW FF
014C: MOVWF F93
014E: MOVFF F81,18
....................
.................... while(true)
.................... {
.................... Output_toggle(LED1);
016E: BCF F92.1
0170: BTG F89.1
0152: BCF F92.1
0154: BTG F89.1
.................... Delay_ms(100);
0172: MOVLW 64
0174: MOVWF 18
0176: BRA 00C6
0156: MOVLW 64
0158: MOVWF 19
015A: BRA 00A8
.................... if(last!=Input_b()) output_high(LED2);
015C: MOVLW FF
015E: MOVWF F93
0160: MOVF F81,W
0162: SUBWF 18,W
0164: BZ 016A
0166: BCF F92.2
0168: BSF F89.2
.................... last=input_b();
016A: MOVLW FF
016C: MOVWF F93
016E: MOVFF F81,18
.................... }
0178: BRA 016E
0172: BRA 0152
.................... }
017A: SLEEP
0174: SLEEP
 
Configuration Fuses:
Word 1: C83F INTRC_IO IESO FCMEN PLL12 CPUDIV4 USBDIV