Hey PICers, I wanted to try and use the RTCC register to detect an input and then grab a data nibble and store it. I know you can't read the RTCC pin directly but you can detect L->H transits by fiddling with the OPTION register and looking for increments in the RTCC register. This would be great because you could save an extra pin in your data registers. I've got a 4x4 keypad hooked up to a 74C922 whose DA goes to RTCC on a 16C57C and Data outputs 1-4 got to the PIC's PORTA. (It's set up on PROTOBOARD, not a PCB) The programme supposedly just grabs the data, stores it in "KeyData" and dumps it to LEDs on PORTB (not shown). Trouble is, nothing much seems to be happening. Works OK on MPLAB but you have to increment RTCC yourself, can't really test its response to the rising edge. OK, from reading the data sheet, it seems to me this trick orta work. But nothing doing. Anyone got any ideas - am I missing something really dumb here? Thnax for advice - PJH **************************************************************** Programme snips :- org 0x00 goto main ;********************************************************************* ;FETCH - monitors the DA 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*C 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 DA in the MAIN PROGRAMME, NOT in this subroutine. ;******************************************************************* fetch clrf TMR0 ;Clear TMR0, 0x001 nop movlw B'11101000' OPTION ;Configure the PRESCALER nop 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,DA ;Tell the main programme nop ;Jump to here if no input retlw 0x00 ;**************************************************************** ;Beginning of main programme from the the upper half of PAGE #0 ;**************************************************************** org 0x0100 main nop call init ;Initialise the ports .. PORTA=INPUT look goto pwr_on ;Power up the device nop ;***************************************************************** ;Now grab the data from the 74C922. ;***************************************************************** bcf flags,VT call fetch btfss flags,VT ;Are data present? goto look+1 ;No .. keep looking goto table ;Yes - jump to the selected routine ..SNIP..