> The main problem I have at present is in programming a delay. The general method is to increment (or decrement) a counter for a specified number of counts. Nesting several counters helps give long delays. If using interrupts (and ultimately all paths lead to interrupts) you can manage a multibyte counter or nest of counters within the ISR (Interrupt Service Routine). eg for a 100 uS interrupt a simple minded but usable delay routine might be. Here_on_interrupt .... inc 100_uS_Counter IF 100_us_Counter = 100 100_uS_Counter = 0 inc 10_mS_Counter IF 10_mS_Counter = 100 10_mS_Counter = 0 inc seconds_counter ENDIF ENDIF This gives you nice decimal submultiples of a second in 2 decade steps (1, .01, .0001 increments) but is less memory efficient than letting each register overflow ______________________ You could look at the PICList site, which is sure to have a few zillion examples, but, as often, Google is your friend. Googles ... PIC delay I'm astounded at how good the first few hits are! Mark's project page, time delays: http://www.mhennessy.f9.co.uk/pic/time_delays.htm Going back to the start of the tutorial will probably be useful http://www.mhennessy.f9.co.uk/pic.htm And Delay code generator On the PICList site as above ;-) http://www.piclist.com/techref/piclist/codegen/delay.htm For 5 seconds using specified registers, gives ; Delay = 5 seconds ; Clock frequency = 4 MHz ; Actual delay = 5 seconds = 5000000 cycles ; Error = 0 % cblock d1 d2 d3 endc Delay ;4999993 cycles movlw 0x2C movwf d1 movlw 0xE7 movwf d2 movlw 0x0B movwf d3 Delay_0 decfsz d1, f goto $+2 decfsz d2, f goto $+2 decfsz d3, f goto Delay_0 ;3 cycles goto $+1 nop ;4 cycles (including call) return ___________________ Also, PIC delay loop calculator http://interaccess.org/arg/arg-list/msg00462.html Russell McMahon -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist