Hello, thanks again for your answer, I just experimented with WDT, it seems it has got todo something with that, (see my prev post). However, I will certainly keep this technique in mind for my final project (I don't know what it's gonna be, but its gotta be something with LEDs coz I just lov um :) Best regards! ----- Original Message ----- From: "Jinx" To: Sent: Tuesday, August 06, 2002 12:18 AM Subject: Re: [PIC]: problems with delays (long newbie posting) > > > run RLF PORTD,1 ;Shift the HIGH up the column > > Modifying the port directly *may* get you in trouble. There's been > quite some discussion on read-modify-write of port latches > > It's better practice to use a shadow register and use that. Don't > read the port, but instead just write the shadow to the port, eg > > movlw 0x01 ;initialise shadow > movwf shadow > movf shadow,w ;write it to port > movwf portd > call delay > > bcf status,carry ;rlf will move the carry flag into bit0 of shadow > rlf shadow,f ;modify shadow > > movf shadow,w > movwf portd ;write it to port > call delay > > btfss shadow,7 ;test for end > goto............ > > etc > > -- > 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