On Mon, 9 Mar 1998, George Kranis wrote: > How can i program the PIC16F84 to delay for 1 sec before make a RA > output equal to 1? > With best regards > gkranis@usa.net > Well there are many ways. Here's one that uses timer0 in a 10Mhz 16X84. The constants are clock frequency dependant of course. An include file called timer.inc that automatically computes the and constants is listed at www.shm.monash.edu.au/~r.kreymborg/pic/lcd.html. Ron dval equ 0x0c ; Constants for a ~20Msec delay prescl equ 7 ; 6 for 4Mhz tmrval equ 61 ; 128 for 4Mhz ... clrwdt bsf STATUS,RP0 movlw b'11010000' | prescl ; prescaler to TMR0 movwf OPTION_REG bcf STATUS,RP0 ... movlw 50 ; wait for 1 second call delay ... delay movwf dval ; save cycle count dly1 clrf TMR0 ; clear timer0 bcf INTCON,T0IF ; clear t0if flag movlw tmrval ; load timer movf TMR0 dly2 btfss INTCON,T0IF ; flag set yet? goto dly2 ; no decfsz dval ; all cycles? goto dly1 ; no return ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ron Kreymborg Computer Systems Manager Monash University CRC for Southern Hemisphere Meteorology Wellington Road Clayton, VIC 3168 Phone : 061-3-9905-9671 Australia Fax : 061-3-9905-9689 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~