James thanks for your help and looking at my code. Yes, I did eventually spot my error as you pointed out in using movf 01h,1.. when it should have been movf 01h,0. I'm testing TMR0 in this way because for there is no interrupts on the 508 AFAIK. I want to complete my code on the F84 and port it to the 508. ----- Original Message ----- From: "James Hillman" To: Sent: 31 August 2001 09:42 Subject: Re: [PIC]: 16F84 & 508 > > I am using the 16F84 to construct my programme to run on the 508 when I > have > > debugged. I have got this.... > > > > movlw b'00000111' ;Set option reg > > movwf 081h > > you need to either access the option register using the OPTION command > > movlw b'00000111' ;Set option reg > option > > or change to bank 1 when you write to the option register > > bsf status,rp0 > movlw b'00000111' ;Set option reg > movwf 081h > bcf status,rp0 > > > . > > movlw .1 > > movwf 01h > > . > > . > > movf 01h,1 > > btfss 03,2 > > goto $-2 > > I am using MPLAB SIM to run my programme but TMR0 does not increment so I > > get stuck in this loop. Is there a bit I should be setting somewhere? > > No, there are no other bits to set AFAIK. > The movf 01h,1 causes the tmr0 register not to change which is why it gets > stuck. I've never tried to check tmr0 this way so I don't know what is > happening there. > > A better way to check for tmr0 reaching zero is to poll the timer0 interrupt > flag. > > LIST P = PIC16F84 > INCLUDE > > org 0 > > movlw b'00000111' ;Set option reg > option > clrf INTCON ;note that GIE and T0IE are cleared > > testloop > btfss INTCON,2 > goto testloop > > stop > goto stop > > end > > > James Hillman > > -- > 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 > > -- 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