Andrew: Thanks for the hints. I found the problem! Your third point of the checklist focused my attention on PORTA! FYI: The following code doesn't work: Bank0 clrf PORTA Bank1_0 movlw 0x06 ; configure all pins as movwf ADCON1 ; as digital inputs movlw 0xcf ; configure all pins as movwf TRISA ; as inputs Where: Bank0 MACRO ;macro to select data RAM bank 0 bcf STATUS,RP0 bcf STATUS,RP1 ENDM Bank1_0 MACRO ;macro to change data RAM from bank 0 to bank 1 bsf STATUS,RP0 ENDM The problem here is probably in line movlw 0xcf ; configure all pins as which is incorrect, because TRISA has only 6 significant bits. I've changed it to: movlw 0x3f and it works fine. Kinda weird... It looks that this unexpected bit messed up MPLAB's brain. Thanks a lot! Ira (just a PIC-beginner) > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Andrew Errington > Sent: Sunday, June 30, 2002 10:09 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: tmr0 as a counter in MPLAB (16F876) > > > > I appreciate any feedback > > Hi, > > there are three things I think you should do. > > 1) Double check the assembler output to be sure your banksel macros are > working, and that the OPTION setup code is correct > 2) Verify that a 1:2 ratio on TMR0 is okay (because that's what the data > sheet says you get with 000 in PS2..PS0, you only get 1:1 with a WDT > assignment). > 3) Verify that the TRIS register for RA4 is correct, and that you can > see the pin state change in a watch window. > > These are the obvious things to check, but I don't use the '87x series > so I've never tried them in MPLAB. I haven't looked for errata for this > topic with MPLAB (too much to sort through...) > > Hope this helps, > > Andy -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu