Sounds like your getting bitten by the watchdog. It has a default delay of 2.3s which at 0.25 seconds per led would get you all the way to the end and one and a bit back before the chip resets and starts again from the beginning. You need to disable it, either in the source file or via the programmer. Cheers, Simon. --- On Mon, Aug 05, 2002 at 10:12:03PM +0200, jumanji wrote: > Hi, thanks for the answer, I think I understand, is it the CBLOCK 0x20 <---- > that you mean? > I didn't put it inthere until today, but it still don't work. (mebbe I have > put it in the wrong place?) > > >From: "Jinx" > > Could be - RAM starts at 0x0c in the F84 and at 0x20 in the F877. > > Assuming the delay used RAM counters and the addresses weren't > > corrected............ > > > Post the listing for the bit(s) giving you trouble, probably easily fixed. > > Make sure to include any references to memory, variable and port > > declarations, the problem may not be where you think it is. Curiously > > though, it is always in the last place you look > > Hmm.. after I have found something, I usually stop searching, so the place > where I found it is automatically the last place where I have looked ;-) > I will paste my whole prog inhere, its just a mix from bits & parts found on > WWW. > When I compile this source, it results in a semi-success, the LED moves from > pos1 to pos8, then goes to pos7, quickly to pos6 & then jumps to pos1 & > starts over again. > > **************************************************************************** > **************** > ; This is an experimental program, bits & parts are used from examples found > on WWW. > Title "LED flasher." > list P = 16F877 > include "P16f877.inc" ; use definition file for 16F877 > org 0x0000 ; start address = 0000h > > ; INITIALISE PORTS > ; binary used to see individual pin level > > movlw b'00000000' ; all port pins = low > movwf PORTA > movlw b'00000000' > movwf PORTB > movlw b'00000000' > movwf PORTC > movlw b'00000000' > movwf PORTD > movlw b'00000000' > movwf PORTE > > bsf STATUS,RP0 ; set RAM Page 1 for TRIS registers > > ; INITIALISE PORTS > ; binary used to see individual pin IO status > > movlw b'00000000' ; all IO pins = outputs > movwf TRISA > movlw b'00000000' > movwf TRISB > movlw b'00000000' > movwf TRISC > movlw b'00000000' > movwf TRISD > movlw b'00000000' > movwf TRISE > > movlw b'00000110' ; all analog pins = digital > movwf ADCON1 > > bcf STATUS,RP0 ;back to RAM page 0 > > litLED BCF STATUS,0 ;Clear the carry flag > MOVLW b'00000001' ;put value in W > MOVWF PORTD ;put W in PORTD > CALL Delay > run RLF PORTD,1 ;Shift the HIGH up the column > CALL Delay > BTFSS PORTD,7 ;Has it reached the top? (check bit 7 of PORTD) > GOTO run ; if no(0), goto run (if 1 skip 'goto run' performs nop) > runback RRF PORTD,1 ;YES. Shift the HIGH down > CALL Delay > BTFSS PORTD,0 ;Has it reached the bottom? > GOTO runback ;if no, goto runback > GOTO run ;YES. Repeat the cycle > > ;============================================================== > ;DELAY GENERATOR CODE HERE > ;============================================================== > > ; Delay = 0.25 seconds > ; Clock frequency = 4 MHz > > ; Actual delay = 0.25 seconds = 250000 cycles > ; Error = 0 % > > cblock 0x20 ;I have added the 0x20 myself > d1 > d2 > endc > > Delay > ;249993 cycles > movlw 0x4E > movwf d1 > movlw 0xC4 > movwf d2 > Delay_0 > decfsz d1, f > goto $+2 > decfsz d2, f > goto Delay_0 > > ;3 cycles > goto $+1 > nop > > ;4 cycles (including call) > return > > ;============================================================== > ;END OF DELAY GENERATOR CODE > ;============================================================== > > END > **************************************************************************** > **************** > > > Thanks again for your help, > Best regards. > > > PS: this Re: was a re on [PIC] without the colon, dunno if it would matter, > but I put one inthere now, just to be sure. > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads