----- Original Message -----
From: "Graham North" <spam_OUTgs_piclistTakeThisOuT
HOTMAIL.COM>
To: <.....PICLISTKILLspam
@spam@MITVMA.MIT.EDU>
Sent: Saturday, April 28, 2001 9:04 AM
Subject: [PIC]: Changing RB0 INT edge trigger
> Hi all,
>
> Thanks for all the help with the interupt problms. I finally got them
> working.
> Guess I'll have to rember OPTION_REG is in Bank1! Doh!
Been there, done that. <GRIN>
> I have just realised that I need the RB0 interupt to trigger on both
edges!
> So
> I have decided to change the trigger edge on the fly. My question is:
>
> Is this the fastest/most efficient way to do this?
>
> BANK1
>
> btfsc OPTION_REG,INTEDG ; IF already set to +ve edge
trigger
{Quote hidden}> goto SET_NEG_EDGE ; Goto set -ve dege trigger
> bsf OPTION_REG,INTEDG ; ELSE set +ve edge trigger
> goto EDGE_SET ; Finished
>
> SET_NEG_EDGE
>
> bcf OPTION_REG,INTEDG ; Set -ve edge trigger
>
> EDGE_SET ; Finished
>
> BANK0
>
> I seem to remember being able to XOR a file with another to do someting.
Is
> that a way change just one bit. I could never get my head round it. Could
> someone
> explain the whole XOR thing.
Just like OR except 1(XOR)1 ->0 That's pretty much it.
0 1
-----------
0 | 0 1
1 | 1 0
WARNING: Untested code ahead ;-) But this is the fastest way I know of.
BANK1
movlw b'01000000' load bit mask for
INTEDG (bit 6)
xorwf OPTION_REG, F flip the bit, leaving
result in OPTION_REG
BANK0
Of course you are left with no idea of which state the bit is currently in,
it just gets flipped.
{Quote hidden}
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics