Hi everyone. The following is my first attempt at a program. I built the NOPPP and everything looks great. I am using a 20mghz ceramic resonator and my breadboard circuit is crude. All IO are open except for the RB4 to which I have connected an LED. It flashes every 16 seconds for 2 seconds. The MPLAB simulator runs as planned - Flash every 8 seconds for one. I would welcome any comments on code style, technique etc. as well. Thanks for your time... LIST P=PIC16F84A, R=d __config H'3FFA' #include "p16f84a.inc" ScratchPadRam EQU 0x20 TMR0 EQU H'01' STATUS EQU H'03' #DEFINE RB4 4 ;-------------------------------------------------------------------------- ; Variables ;-------------------------------------------------------------------------- cblock 0x0C timer_lo ;LSB for period counter timer_hi ;MSB for period counter Seconds ;seconds Minutes ;minutes 0-59 Hours ;hours Quant1 ;number of counts for feeder 1 Quant2 ;number of counts for feeder 2 Quant3 ;number of counts for feeder 3 Quant4 ;number of counts for feeder 4 DispenCnt ;int? input from counter endc ;-------------------------------------------------------------------------- ;Start of ROM ;-------------------------------------------------------------------------- ORG 0 GOTO Start ;---------------------------------------- ;Interrupt Service Routine ;---------------------------------------- ORG 0x04 Intsvc clrwdt ;clear watchdog timer to ensure startup bcf INTCON,2 ;clear interrupt flag before return incf timer_lo,f ;increment LSByte btfsc STATUS,Z ;zero set means overflow incf timer_hi,f ;increment MSByte movlw H'4B' ;LSB tweak factor 4996891 xorwf timer_lo,w ;compare btfss STATUS,Z ;are they the same? retfie ;nope go back movlw H'4C' ;MSB tweak factor xorwf timer_hi,w ;compare btfss STATUS,Z ;are they the same? retfie ;nope go back incf Seconds,f ;increment seconds finally rlf PORTB,f ;every 7 seconds portb4 should flash clrf timer_lo ;clear LSB clrf timer_hi ;clear MSB movlw H'3C' ;get ready to check for a minute xorwf Seconds,w ;compare btfss STATUS,Z ;are they the same? retfie ;nope go back incf Minutes,f ;yes-add a minute clrf Seconds ;clear Seconds - at 60 movlw H'3C' ;get ready to check for an hour xorwf Minutes,w ;compare btfss STATUS,Z ;are they the same? retfie ;nope go back incf Hours,f ;yes - another hour clrf Minutes ;clear Minutes - at 60 movlw H'18' ;check for hour roll xorwf Hours,w ;compare btfss STATUS,Z ;are they the same? retfie ;not yet midnight clrf Hours ;it is midnight retfie ;return from interrupt Timer_init bcf INTCON, 2 bsf INTCON, 7 bsf INTCON, 5 clrf TMR0 clrwdt movlw b'11011000' option clrf TMR0 retlw 0 Port_Init BCF STATUS, RP0 ; CLRF PORTB ; Initialize PORTB BSF STATUS, RP0 ; Select Bank 1 MOVLW H'00' ; Value used to MOVWF TRISB ; Set RB<3:0> as inputs RB<5:4> as outputs RB<7:6> as inputs Start call Timer_init Loop: nop nop goto Loop end -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics