Truncated match.
PICList
Thread
'RTCC as INPUT (II)'
1999\08\23@023926
by
PJH
|
PICers,
Ha - it works! This is the sorta
thing that makes you look like a
real schmutz. OBVIOUSLY, you've
gotta configure TMR0 separately and
then test for an increment. I was
doing config & inc test in the same
sub-routine, which means you'd have
to be lucky for your rising edge to
rise in the few u-secs between
configuring and testing. Well,
figured that one out for myself ...
;**********************************************************************
;PROBLEM : Use RTCC to detect
presence of a data pulse and then
grab the data nibble in
;PORTA and store it.
;
;TMRset configures RTCC to
increment on the rising edge of an
input
;pulse applied to the TMR0 pin.
Used to detect the presence of
data.
;**********************************************************************
TMRset clrf TMR0 ;Clear
TMR0, 0x001
nop
movlw B'11101000'
OPTION
;Configure the PRESCALER
nop
retlw 0x00
;*********************************************************************
;FETCH - monitors the VT pin on the
74C922, grabs the data nibble and
;stores it in KeyData. It then sets
b3 in flags before returning.
;This routine uses the transits on
TOCK1 to determine if an input is
;present. RTCC=TOCK1 in the newer
PIC 16C5* series.
;OPTION.3=1 .. prescaler assigned
to the WDT
;OPTION.4=0 .. increment on L->H
transit on TOCK1
;OPTION.5=1 .. transition on TOCK1
pin
;OPTION.0,1,2=0 ..
;Restore the default OPTION setting
before we leave?
;Clear VT in the MAIN PROGRAMME,
NOT in this subroutine.
;*******************************************************************
fetch btfss TMR0,0 ;Has
TMR0 been incremented?
goto $+4 ;No -
exit the subroutine.
movf PORTA,0 ;Yes -
there are data present.
movwf KeyData ;Store
the data
bsf flags,VT ;Tell
the main programme
nop ;Jump
to here if no input
clrf TMR0 ;And
clear TMR0 before leaving
retlw 0x00
More... (looser matching)
- Last day of these posts
- In 1999
, 2000 only
- Today
- New search...