PDA

View Full Version : inputs on 12F675 (or for that matter any PIC)



muddy0409
- 11th April 2007, 17:42
Hi all,
Short of using interrupts on GPIO change, is there any way to have the digital inputs latch up until read. I think I sorta want an interrupt type of thing but without all the interrupt programming. I remember the old 6821 PIA had provision to latch the inputs, if they changed and cleared when the input register was read. Any such sorta thing available on PICs?
I am, BTW, R'ingTFM but aren't up to that bit yet.
I will be having a pretty short change on the inputs with the possibility of missing them while off doing other things. Perfect scenario for interrupts I know, but I just wanna do it the lazy way.
Serve me bloody right if I hafta use interrupts, won't it?
I have done the design with RS flip flops, which works beaut, but takes up too much real estate on the PCB.

HenrikOlsson
- 11th April 2007, 19:30
Hi,
How many inputs do you need to 'latch' ? And do you need to catch the 'change' or just that there is or has been a high level on the input since last read?

The only way I can think of without using interrupts or external hardware is to set up TMR0 and TMR1 (for 12F675) as counters. The value of the TMR registers will then be different between reads if the pin(s) have changed from low to high.

/Henrik Olsson.

peterdeco1
- 11th April 2007, 19:43
I did something like this a long time ago to catch a change:

X VAR BIT

START:
LET X = (YOUR INPUT PIN)
NAP 4
IF X <> (YOUR INPUT PIN) THEN RUN
GOTO START

RUN:
DO YOUR THING HERE