AN566 method still valid?

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
28,617
Are using the methods outlined in picmicro AN566 for using a P.B. on GPx implementing a IOC still a valid method?
The app note is 20+yrs old so just wondered if there was a updated means of using a IOC on a rising edge for a P.B. and ignoring the following falling edge.
The External input pin is used so the general IOC is being used.
12F683.
Max.
 

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
28,617
#2 shows the external interrupt on GP2, but I am using that for the PWM output so it leaves the general IOC inputs which interrupt on both falling and rising edges.
Max.
 

AlbertHall

Joined Jun 4, 2014
12,343
On the more recent chips (below is an extract from PIC12F1840) you can select which edge (or still both edges) generates interrupts.
13.2
Individual Pin Configuration
For each PORTA pin, a rising edge detector and a falling
edge detector are present. To enable a pin to detect a
rising edge, the associated IOCAPx bit of the IOCAP
register is set. To enable a pin to detect a falling edge,
the associated IOCANx bit of the IOCAN register is set.
A pin can be configured to detect rising and falling
edges simultaneously by setting both the IOCAPx bit
and the IOCANx bit of the IOCAP and IOCAN registers,
respectively.
 

jpanhalt

Joined Jan 18, 2008
11,087
Hi Max,

I think you are right. It has been a long time since I played with the 12F683, but I cannot find an edge select register/function. Can you switch to the 12F1840?
 

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
28,617
On the 12F683 there is only one edge select INT and that is shared with the PWM, all other pins are IOC and INT on both edges, non-selectable.
I would like to use the 683 of possible, but I can try the AN566 method but just wondered if there was a more current method .
Max.
 

jpanhalt

Joined Jan 18, 2008
11,087
Hi Max,

Yes, I was referring to all but the INT. AN566 seems reasonable. Why not use it? As an alternative, one might invent an alternating interrupt (e.g., use an XOR function), but I don't think that would be as reliable as just reading the pin as AN566 does. The former would fail, for example, if the pulse width was less then the interrupt time.
 

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
28,617
This would be an externally debounced manual P.B. input so I envision the definition according to AN566 would be a Wide Pulse Width (example:2).
I had some uncertainty in understanding the Read PORTB to itself to end mismatch , movf PORTB, F .
Max.
 
Top