Searching \ for 'Mixed use PORTB with Interrupt on Change' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ints.htm?key=interrupt
Search entire site for: 'Mixed use PORTB with Interrupt on Change'.

Truncated match.
PICList Thread
'Mixed use PORTB with Interrupt on Change'
2000\05\10@105211 by Howard McGinnis

flavicon
face
Hello,

I'm using a 16F873 in an application and plan to use PORTB as 5 inputs, 3
outputs with the inputs being bits 3-7 to take advantage of the interrupt
on change feature. The docs caution against reading the port which is
understandable.

Does the PIC do a read-alter-write when executing a BSF or BCF instruction
or does it have the ability to set or reset a bit directly? Does using
PORTB in this mixed mode screw up the interrupt on change?

Thanks,
howard
Howard McGinnis
spam_OUThmcginniTakeThisOuTspamdigital.net
Electronic Visions, Inc.
1650 Barrett Drive
Rockledge FL 32955
(321) 632-7530
http://ddi.digital.net/~hmcginni
.....mcginnisKILLspamspam@spam@e-visions.com

2000\05\10@105835 by smerchock, Steve

flavicon
face
Howard,
The PIC does a "read-alter-write". My best advice would be to
use a "shadow" register. Set that corresponding bit in the
"shadow" register then move it into that port register.

Best regards,
Steve


Steven Kosmerchock
Radio Frequency Systems
Phoenix  Arizona  USA
http://www.rfsworld.com
steve.kosmerchockspamKILLspamrfsworld.com

http://www.geocities.com/researchtriangle/lab/6584



{Original Message removed}

2000\05\10@134329 by pandersn

flavicon
face
Howard....

I don't think the docs mean not to read. You couldn't do anything then. See
page 31 of the current f873 data sheet. Each time you test a bit it must
read the D flip-flop to know what the state of the INPUT is. A change flag
is set if and only if the change DFF is EXOR with the previous value at
that pin....I think. Agree the data sheet is somewhat confusing.

To make sure, I'd simply try each case, writing a simple program, and
changing the various inputs. The convoluted docs will then become
clear...i.e. writer's intent.

Phil.


On Wednesday, May 10, 2000 9:50 AM, Howard McGinnis
[SMTP:.....hmcginniKILLspamspam.....DIGITAL.NET] wrote:
> Hello,
>
> I'm using a 16F873 in an application and plan to use PORTB as 5 inputs, 3
> outputs with the inputs being bits 3-7 to take advantage of the interrupt
> on change feature. The docs caution against reading the port which is
> understandable.
>
> Does the PIC do a read-alter-write when executing a BSF or BCF
instruction
{Quote hidden}

2000\05\10@160642 by Robert Rolf

picon face
Shadow register won't help. Even the MOV instructions are
`READ/PROCESS/WRITE, and the 'read' part will update the change bits.
Been there. Have the flame marks.

This is a fundamental problem with the 'PORTB change' function.
You can't use the port for ANYTHING else (except one time setup)
if you want to use PORTB change at high rates in/out and have NO
missed changes.

Had to keep a shadow INPUT register and checked for changes -after- any
write to B (with a verify read), and called a special version of the ISR
to deal with non-interrupt-generating changes. The special version got
called about 1% of the time at my int rates (1kHz) showing that
I had indeed been loosing pulses. (CCPx were used in another parts
of the app)


"Kosmerchock, Steve" wrote:
{Quote hidden}

> {Original Message removed}

2000\05\10@182708 by Andrew Warren

face
flavicon
face
Phil Anderson <KILLspampandersnKILLspamspamidir.net> wrote:

> [If Port B can't even be read without screwing up the
> interrupt-on-change hardware,] you couldn't do anything then.

   Howard's correct, Phil; ANYTHING you do to port B (read OR
   write) in your main program has the potential to interfere with
   proper operation of the interrupt-on-change feature.  The ONLY
   100%-reliable thing you can do with that feature is use it to
   wake up from sleep mode.

   -Andy


=== Andrew Warren - RemoveMEfastfwdTakeThisOuTspamix.netcom.com
=== Fast Forward Engineering - San Diego, California
=== http://www.geocities.com/SiliconValley/2499

2000\05\11@045818 by Andy Shaw
flavicon
face
Yes BSF/BCF do use read-alter-write, and yes this will screw up the int on
change stuff if the timing of things is just right (or wrong in this case
:-)). At least it screwed things up for me! Anyone got any good solutions
for this problem. I managed to work round it by arranging things so that I
only need to write to the port during a window when I know that there will
be no changes on the input side of things (or at least there shouldn't be!).
Not sure what happens if you use some sort of shadow register and then do a
byte wide write to the port. I've not tried this anyone know if it helps?

One last thing according to my copy of the 87X spec (rather old I'm at work
at the moment), RB3 does not have int on change only RB4-RB7.

Andy

{Original Message removed}

2000\05\11@063117 by Caisson

flavicon
face
> Van: Andy Shaw <spamBeGoneandysspamBeGonespamSCO.COM>
> Aan: TakeThisOuTPICLISTEraseMEspamspam_OUTMITVMA.MIT.EDU
> Onderwerp: Re: Mixed use PORTB with Interrupt on Change
> Datum: donderdag 11 mei 2000 10:40

[Snip]

> One last thing according to my copy of the 87X spec (rather old I'm at
work
> at the moment), RB3 does not have int on change only RB4-RB7.

You could try to use RB0.  The edge-select for an interrupt will enable you
to see any change.  You can't configure it as fast as you can RB4 thru 7,
but it'll work ...

Regards,
 Rudy Wieser

2000\05\11@094619 by Gerhard Kammerer

flavicon
face
Maybe a workaround:

Put the signal on two input pins.
The first direct, the second via RC combination (1k/1n).

So at least one change comes through.

Gerhard

Andrew Warren schrieb:
{Quote hidden}

2000\05\11@094631 by Gerhard Kammerer

flavicon
face
Sorry, the signal on the second pin must then be inverted

My fault

Gerhard

2000\05\13@034531 by pandersn

flavicon
face
Howard....

I don't think the docs mean not to read. You couldn't do anything then. See
page 31 of the current f873 data sheet. Each time you test a bit it must
read the D flip-flop to know what the state of the INPUT is. A change flag
is set if and only if the change DFF is EXOR with the previous value at
that pin....I think. Agree the data sheet is somewhat confusing.

To make sure, I'd simply try each case, writing a simple program, and
changing the various inputs. The convoluted docs will then become
clear...i.e. writer's intent.

Phil.


On Wednesday, May 10, 2000 9:50 AM, Howard McGinnis
[SMTP:hmcginniEraseMEspam.....DIGITAL.NET] wrote:
> Hello,
>
> I'm using a 16F873 in an application and plan to use PORTB as 5 inputs, 3
> outputs with the inputs being bits 3-7 to take advantage of the interrupt
> on change feature. The docs caution against reading the port which is
> understandable.
>
> Does the PIC do a read-alter-write when executing a BSF or BCF
instruction
{Quote hidden}

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...