1 LIST Q = 37 2 07F9 0F7F DEVICE SX28L, TURBO, STACKX, OSCHS2 3 =00000002 IRC_CAL IRC_FAST 4 =02FAF080 FREQ 50_000_000 5 07FF 0A0D RESET Main 6 7 =00000000 org $000 8 =00000000 ISR 9 0000 0059 mode $09 ; Select WKPND_B 10 0001 0040 clr w 11 0002 0006 mov !rb, w ; Exchange WKPND_B and w 12 0003 0D00 test w ; Any WKPND_B bits set? 13 0004 0643 snz 14 0005 0A08 jmp :RTCCInt ; No, must be an RTCC interrupt 15 0006 01A5 xor ra, w ; Toggle ra.1 or ra.0 depending on which WKPND_B it (1 or 0) is set 16 0007 000E reti 17 =00000008 :RTCCInt 18 0008 0C04 xor ra, #%00000100 ; Toggle RA.2 0009 01A5 19 000A 0CFA mov RTCC, #250 000B 0021 20 000C 000E reti 21 22 =0000000D Main 23 000D 005B mode $0b ; Select WKEN_B 24 000E 0CFC mov !rb, #%11111100 ; Enable interrupts on RB.1 and RB.0 000F 0006 25 0010 005A mode $0a ; Select WKED_B 26 0011 0CFD mov !rb, #%11111101 ; Positive edge on RB.1, negative on RB.0 0012 0006 27 0013 005F mode $0f ; Select TRIS 28 0014 0CF8 mov !ra, #%11111000 ; RA.2 ... RA.0 are outputs 0015 0005 29 0016 0CFA mov RTCC, #250 0017 0021 30 0018 0CA8 mov !option, #%10101000 ; Enable RTCC interrupts, external RTCC clock, 0019 0002 31 ; positive edges, no prescaler. 32 001A 0A1A jmp $ 33 Cross Reference 9 symbols Symbol Type Value Line __SASM DATA 00000001 0000 __SX_FREQ DATA 02FAF080 0004 __SX_IRC_CAL DATA 00000002 0003 __SX_RESET RESB 00000A0D 0005 ISR ADDR 00000000 0008 ISR:RTCCInt ADDR 00000008 0017 Main ADDR 0000000D 0022 ra RESV 00000005 0015 RTCC RESV 00000001 0019