piclist 2002\08\05\182054a >
Thread: problems with delays (long newbie posting)
face picon face BY : Jinx email (remove spam text)

> > 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


http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

<002d01c23cce$12f0dda0$679ca7cb@joe> 7bit

See also: www.piclist.com/techref/microchip/begin.htm?key=delay
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) problems with delays (long newbie posting)

month overview.

new search...